UNPKG

angular-odata

Version:

Client side OData typescript library for Angular

88 lines (87 loc) 3.7 kB
import { Observable } from 'rxjs'; import { ODataApi } from '../../api'; import { ModelInterface, ODataModel } from '../../models'; import { QueryOption } from '../../types'; import { ODataResource } from '../resource'; import { ODataEntity } from '../response'; import { ODataActionResource } from './action'; import { ODataFunctionResource } from './function'; import { ODataNavigationPropertyResource } from './navigation-property'; import { ODataOptions } from './options'; import { ODataPropertyResource } from './property'; export declare class ODataSingletonResource<T> extends ODataResource<T> { static factory<S>(api: ODataApi, { path, type, }: { path: string; type?: string; }): ODataSingletonResource<S>; clone(): ODataSingletonResource<T>; key(value: any): ODataSingletonResource<T>; keys(values: any[]): ODataSingletonResource<T>; navigationProperty<N>(path: string): ODataNavigationPropertyResource<N>; property<P>(path: string): ODataPropertyResource<P>; action<P, R>(path: string): ODataActionResource<P, R>; function<P, R>(path: string): ODataFunctionResource<P, R>; protected post(attrs: Partial<T>, options?: ODataOptions): Observable<any>; protected put(attrs: Partial<T>, options?: ODataOptions): Observable<any>; protected patch(attrs: Partial<T>, options?: ODataOptions): Observable<any>; protected delete(options?: ODataOptions): Observable<any>; protected get(options?: ODataOptions & { bodyQueryOptions?: QueryOption[]; }): Observable<any>; /** * Creates a new entity. * @param attrs The entity attributes to create. * @param options The options for the request. * @returns The created entity with the annotations. */ create(attrs: Partial<T>, options?: ODataOptions): Observable<ODataEntity<T>>; /** * Updates an existing entity. * @param attrs The entity attributes to update. * @param options The options for the request. * @returns The updated entity with the annotations. */ update(attrs: Partial<T>, options?: ODataOptions): Observable<ODataEntity<T>>; /** * Modifies an existing entity. * @param attrs The entity attributes to modify. * @param options The options for the request. * @returns The modified entity with the annotations. */ modify(attrs: Partial<T>, options?: ODataOptions): Observable<ODataEntity<T>>; /** * Delete an existing entity. * @param options The options for the request. * @returns Observable of the deleted entity. */ destroy(options?: ODataOptions): Observable<any>; /** * Fetch an existing entity. * @param options The options for the request. * @returns Observable of the entity with the annotations. */ fetch(options?: ODataOptions & { bodyQueryOptions?: QueryOption[]; }): Observable<ODataEntity<T>>; /** * Fetch an existing entity. * @param options The options for the request. * @returns Observable of the entity. */ fetchEntity(options?: ODataOptions & { bodyQueryOptions?: QueryOption[]; }): Observable<T | null>; /** * Fetch an existing entity and return a model. * @param options The options for the request. * @returns Observable of the entity. */ fetchModel(options?: ODataOptions & { bodyQueryOptions?: QueryOption[]; ModelType?: typeof ODataModel; }): Observable<(ODataModel<T> & ModelInterface<T>) | null>; fetchModel<M extends ODataModel<T>>(options?: ODataOptions & { bodyQueryOptions?: QueryOption[]; ModelType?: typeof ODataModel; }): Observable<M | null>; }