UNPKG

angular-odata

Version:

Client side OData typescript library for Angular

109 lines (108 loc) 4.67 kB
import { Observable } from 'rxjs'; import { ODataCache } from './cache'; import { ModelOptions, ODataCollection, ODataModel, ODataModelOptions } from './models'; import { ODataApiOptions } from './options'; import { ODataOptions, ODataResource, ODataSegment } from './resources'; import { ODataRequest, ODataBatchResource, ODataMetadataResource, ODataActionResource, ODataFunctionResource, ODataEntityResource, ODataEntitySetResource, ODataSingletonResource, ODataNavigationPropertyResource } from './resources'; import { ODataCallable, ODataEntitySet, ODataEnumType, ODataSchema, ODataSingleton, ODataStructuredType } from './schema'; import { ApiConfig, EdmType, ODataVersion, Parser, QueryOption, SchemaConfig } from './types'; import { ODataMetadata } from './metadata/metadata'; /** * Api abstraction for consuming OData services. */ export declare class ODataApi { requester?: (request: ODataRequest<any>) => Observable<any>; serviceRootUrl: string; metadataUrl: string; name?: string; version: ODataVersion; default: boolean; creation: Date; options: ODataApiOptions; cache: ODataCache; errorHandler?: (error: any, caught: Observable<any>) => Observable<never>; parsers: Map<string, Parser<any>>; schemas: ODataSchema[]; constructor(config: ApiConfig); configure(settings?: { requester?: (request: ODataRequest<any>) => Observable<any>; }): void; populate(metadata: ODataMetadata): void; fromJson<P, R>(json: { segments: ODataSegment[]; options: { [name: string]: any; }; }): ODataActionResource<P, R> | ODataFunctionResource<P, R>; fromJson<E>(json: { segments: ODataSegment[]; options: { [name: string]: any; }; }): ODataEntityResource<E> | ODataEntitySetResource<E> | ODataNavigationPropertyResource<E> | ODataSingletonResource<E>; /** * Build a metadata resource. * @returns ODataMetadataResource */ metadata(): ODataMetadataResource; /** * Build a batch resource. * @returns ODataBatchResource */ batch(): ODataBatchResource; /** * Build a singleton resource. * @param path Name of the singleton * @returns */ singleton<T>(name: string): ODataSingletonResource<T>; /** * Build an entity set resource. * @param path Name of the entity set * @returns */ entitySet<T>(name: string): ODataEntitySetResource<T>; /** * Unbound Action * @param {string} path? * @returns ODataActionResource */ action<P, R>(path: string): ODataActionResource<P, R>; /** * Unbound Function * @param {string} path? * @returns ODataFunctionResource */ function<P, R>(path: string): ODataFunctionResource<P, R>; callable<T>(type: string): ODataCallable<T> | undefined; enumType<T>(type: string): ODataEnumType<T> | undefined; structuredType<T>(type: string): ODataStructuredType<T> | undefined; request<T>(method: string, resource: ODataResource<any>, options: ODataOptions & { body?: any; etag?: string; responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities'; observe?: 'body' | 'events' | 'response'; withCount?: boolean; bodyQueryOptions?: QueryOption[]; }): Observable<any>; private memo; createSchema(config: SchemaConfig): ODataSchema; findSchema(type: string): ODataSchema | undefined; findEnumType<T>(value: string): ODataEnumType<T> | undefined; findStructuredType<T>(value: string): ODataStructuredType<T> | undefined; findCallable<R>(value: string, bindingType?: string): ODataCallable<R> | undefined; findEntitySet(value: string): ODataEntitySet | undefined; findSingleton(value: string): ODataSingleton | undefined; findModel(type: string): typeof ODataModel | undefined; createModel(structured: ODataStructuredType<any>): typeof ODataModel; modelForType(type: string): typeof ODataModel; findCollection(type: string): typeof ODataCollection | undefined; createCollection(structured: ODataStructuredType<any>, model?: typeof ODataModel<any>): typeof ODataCollection; collectionForType(type: string): typeof ODataCollection; findEntitySetForEntityType(entityType: string): ODataEntitySet | undefined; parserForType<T>(type: string | EdmType, bindingType?: string): Parser<T>; optionsForType<T>(type: string, { structuredType, config, }?: { structuredType?: ODataStructuredType<T>; config?: ModelOptions; }): ODataModelOptions<T> | undefined; }