UNPKG

baasic-sdk-javascript

Version:

JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).

70 lines (69 loc) 3.3 kB
import { ModelMapper, Utility, DateFormatter } from './'; import { IAppOptions } from '../core/contracts'; export declare abstract class BaseRoute { protected appOptions: IAppOptions; protected utility: Utility; protected dateFormatter: DateFormatter; protected modelMapper: ModelMapper; constructor(appOptions: IAppOptions); /** * Parses resources route which can be expanded with additional options. Supported items are: * - `searchQuery` - A string value used to identify resources using the phrase search. * - `page` - A value used to set the page number, i.e. to retrieve certain resource subset from the storage. * - `rpp` - A value used to limit the size of result set per page. * - `sort` - A string used to set the resource property to sort the result collection by. * - `embed` - Comma separated list of resources to be contained within the current representation. * @method * @returns Query resources uri with search params * @example baasicBaseDefinition.find(); **/ protected baseFind(route: string, options?: any): any; /** * Parses get resource route which must be expanded with the Id of the previously created resource in the system. * @returns get resource uri * @method * @example baseRoute.get(route, id); **/ protected baseGet(route: string, id?: any, options?: any, propName?: string): any; /** * Parses get resource route which must be expanded with the Id of the previously created resource in the system. * @returns get resource uri * @method * @example baseRoute.create(); **/ protected baseCreate(route: string, data?: any): any; /** * Parses get resource route. * @returns update resource uri * @method * @example baseRoute.update(); */ protected baseUpdate(route: string, data: any, options?: any, linkName?: string): any; /** * Parses delete resource route. * @returns delete resource uri. * @method * @example baseRoute.delete(); */ protected baseDelete(route: string, data: any, options?: any, linkName?: string): any; createParams(data: any, prop?: string): any; updateParams(data: any): any; deleteParams(data: any): any; deleteBatchParams(data: any[]): string[]; /** * Parses and expands URI templates based on [RFC6570](http://tools.ietf.org/html/rfc6570) specifications. For more information please visit the project [GitHub](https://github.com/Baasic/uritemplate-js) page. * @method * @example baseRoute.parse('<route>/{?embed,fields,options}').expand({embed: '<embedded-resource>'}); **/ parse(route: string): any; } /** * @copyright (c) 2017 Mono Ltd * @license MIT * @author Mono Ltd * @overview ***Notes:** - Refer to the [Baasic REST API](http://dev.baasic.com/api/reference/home) for detailed information about available Baasic REST API end-points. - [URI Template](https://github.com/Baasic/uritemplate-js) syntax enables expanding the Baasic route templates to Baasic REST URIs providing it with an object that contains URI parameters. - All end-point objects are transformed by the associated route service. */