UNPKG

angular-odata

Version:

Client side OData typescript library for Angular

116 lines (115 loc) 4.58 kB
import { Observable } from 'rxjs'; import { ODataApi } from '../../api'; import type { ModelInterface, ODataCollection, ODataModel } from '../../models'; import { QueryOption, StructuredTypeFieldConfig } from '../../types'; import { ODataPathSegments } from '../path'; import { ApplyExpression, ApplyExpressionBuilder } from '../query'; import { ODataResource } from '../resource'; import { ODataEntities, ODataEntity, ODataProperty } from '../response'; import { ODataEntitiesOptions, ODataEntityOptions, ODataOptions, ODataPropertyOptions } from './options'; import { ODataValueResource } from './value'; import { ODataCountResource } from './count'; import { ODataEntitiesAnnotations } from '../../annotations'; export declare class ODataPropertyResource<T> extends ODataResource<T> { static factory<P>(api: ODataApi, { path, type, segments, }: { path: string; type?: string; segments: ODataPathSegments; }): ODataPropertyResource<P>; static fromResource<N>(resource: ODataResource<any>, path: string): ODataPropertyResource<N>; clone(): ODataPropertyResource<T>; transform<R>(opts: (builder: ApplyExpressionBuilder<T>, current?: ApplyExpression<T>) => ApplyExpression<T>, { type, fields, }?: { type?: string; fields?: { [name: string]: StructuredTypeFieldConfig; }; }): ODataPropertyResource<R>; key(value: any): ODataPropertyResource<T>; keys(values: any[]): ODataPropertyResource<T>; value(): ODataValueResource<T>; count(): ODataCountResource<T>; property<P>(path: string): ODataPropertyResource<P>; protected get(options?: ODataEntityOptions & ODataEntitiesOptions & ODataPropertyOptions): Observable<any>; /** * Fetch the property * @param options Options for the request * @return The entity / entities / property value */ fetch(options?: ODataEntityOptions): Observable<ODataEntity<T>>; fetch(options?: ODataEntitiesOptions): Observable<ODataEntities<T>>; fetch(options?: ODataPropertyOptions): Observable<ODataProperty<T>>; /** * Fetch the property value * @param options Options for the request * @returns The property value */ fetchProperty(options?: ODataOptions): Observable<T | null>; /** * Fetch the entity * @param options Options for the request * @returns The entity */ fetchEntity(options?: ODataOptions): Observable<T | null>; /** * Fetch the entity and return as model * @param options Options for the request * @returns The model */ 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>; /** * Fetch the entities * @param options Options for the request * @returns The entities */ fetchEntities(options?: ODataOptions & { withCount?: boolean; }): Observable<T[] | null>; /** * Fetch the entities and return as collection * @param options Options for the request * @returns The collection */ fetchCollection(options?: ODataOptions & { withCount?: boolean; bodyQueryOptions?: QueryOption[]; CollectionType?: typeof ODataCollection; }): Observable<ODataCollection<T, ODataModel<T> & ModelInterface<T>> | null>; fetchCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(options?: ODataOptions & { withCount?: boolean; bodyQueryOptions?: QueryOption[]; CollectionType?: typeof ODataCollection; }): Observable<C | null>; fetchOne(options?: ODataOptions & { withCount?: boolean; bodyQueryOptions?: QueryOption[]; }): Observable<{ entity: T | null; annots: ODataEntitiesAnnotations<T>; }>; fetchMany(top: number, options?: ODataOptions & { withCount?: boolean; bodyQueryOptions?: QueryOption[]; }): Observable<{ entities: T[]; annots: ODataEntitiesAnnotations<T>; }>; /** * Fetch all entities * @param options Options for the request * @returns All entities */ fetchAll(options?: ODataOptions & { withCount?: boolean; bodyQueryOptions?: QueryOption[]; }): Observable<{ entities: T[]; annots: ODataEntitiesAnnotations<T>; }>; }