import { HttpUtility } from 'rl-http'; import { ArrayUtility } from '../../array/array.service'; import { IConverter } from '../converters/converters'; import { IDataService, IBaseDomainObject } from '../dataService/data.service'; import { IDataServiceView, IParentDataServiceView } from '../dataService/view/dataServiceView'; import { IParentDataService } from '../dataService/parent/parentData.service'; import { ISingletonDataService } from '../singletonDataService/singletonData.service'; import { IParentSingletonDataService } from '../singletonDataService/parent/parentSingletonData.service'; export interface IBaseOptions { /** * Url to hit with getList and create * - extended with /id for getDetail, update, and delete */ endpoint?: string; /** * Flag for specifying if the data service should use the mock data or hit the actual endpoint * defaults to true if endpoint is not defined */ useMock?: boolean; /** * Flag for specifying if the data service should log all requests against the contract */ logRequests?: boolean; /** * Mapping to specify how properties should be transformed to and from the server */ transform?: IConverter | { [index: string]: IConverter; }; } export interface IBaseResourceParams extends IBaseOptions { /** * Example data set to be used for testing and prototyping instead of hitting the endpoint */ mockData?: TDataType[]; /** * Specifies that the data service needs to use a POST request to send search params to the server */ useDeepSearch?: boolean; } export interface IParentResourceParams extends IBaseResourceParams { /** * Function that builds a dictionary of child resources available through childContracts(id) */ resourceDictionaryBuilder?: { (): TResourceDictionaryType; }; } export interface ISingletonResourceParams extends IBaseOptions { /** * Example object to be used for testing and prototyping instead of hitting the endpoint */ mockData?: TDataType; } export interface IParentSingletonResourceParams extends ISingletonResourceParams { /** * Function that builds a dictionary of child resources available through childContracts(id) */ resourceDictionaryBuilder?: { (): TResourceDictionaryType; }; } export interface IResourceBuilder { /** * Create a standard resource with getList, getDetail, create, update, delete */ createResource(options: IBaseResourceParams): IDataService; /** * Create a standard resource with getList, getDetail, create, update, delete */ createResource(options: IBaseResourceParams): IDataService; /** * Create a view of a parent resource that can be used as a base resource or * as a singleton if a parent is selected */ createResourceView(options: IBaseResourceParams): IDataServiceView; /** * Create a view of a parent resource that can be used as a base resource or * as a singleton if a parent is selected */ createResourceView(options: IBaseResourceParams): IDataServiceView; /** * Create a parent resource that extends the standard with child resources available through childContracts(id) */ createParentResource(options: IParentResourceParams): IParentDataService; /** * Create a parent resource that extends the standard with child resources available through childContracts(id) */ createParentResource(options: IParentResourceParams): IParentDataService; /** * Create a view of a parent resource with sub-resources that can be used as a base resource or * as a singleton if a parent is selected */ createParentResourceView(options: IParentResourceParams): IParentDataServiceView; /** * Create a view of a parent resource with sub-resources that can be used as a base resource or * as a singleton if a parent is selected */ createParentResourceView(options: IParentResourceParams): IParentDataServiceView; /** * Deprecated - Create a singleton resource with get and update */ createSingletonResource(options: ISingletonResourceParams): ISingletonDataService; /** * Deprecated - Create a parent singleton resource that extends the singleton with child resources available through childContracts(id) */ createParentSingletonResource(options: IParentSingletonResourceParams): IParentSingletonDataService; } export declare class ResourceBuilder implements IResourceBuilder { private http; private array; constructor(http: HttpUtility, array: ArrayUtility); createResource(options: IBaseResourceParams): IDataService; createResourceView(options: IBaseResourceParams): IDataServiceView; createParentResource(options: IParentResourceParams): IParentDataService; createParentResourceView(options: IParentResourceParams): IParentDataServiceView; createSingletonResource(options: ISingletonResourceParams): ISingletonDataService; createParentSingletonResource(options: IParentSingletonResourceParams): IParentSingletonDataService; private useMockIfNoEndpoint(options); }