UNPKG

angular-odata

Version:

Client side OData typescript library for Angular

121 lines (120 loc) 4.57 kB
import { Observable } from 'rxjs'; import { ODataCollection } from '../models/collection'; import { ODataModel } from '../models/model'; import { EntityKey, ODataEntity, ODataEntityResource, ODataEntitySetResource, ODataOptions } from '../resources'; import { ODataEntityService } from './entity'; export declare class ODataEntitySetService<T> extends ODataEntityService<T> { static Model?: typeof ODataModel; static Collection?: typeof ODataCollection; model(entity?: Partial<T>, reset?: boolean): ODataModel<T> & import("angular-odata").ModelInterface<T>; collection(entities?: Partial<T>[], reset?: boolean): ODataCollection<T, ODataModel<T> & import("angular-odata").ModelInterface<T>>; /** * Get the entity set resource for this service. */ entities(): ODataEntitySetResource<T>; /** * Get the entity resource for this service. * @param key The entity key. */ entity(key?: EntityKey<T>): ODataEntityResource<T>; /** * Attach an existing model to this service. * @param model The model to attach. */ attach<M extends ODataModel<T>>(model: M): void; attach<C extends ODataCollection<T, ODataModel<T>>>(model: C): void; /** * The schema for the entity set. */ get entitySetSchema(): import("angular-odata").ODataEntitySet | undefined; /** * Get all entities from the entity set. * @param options The options for the request. */ fetchAll(options?: ODataOptions): Observable<{ entities: any[]; annots: import("angular-odata").ODataEntitiesAnnotations<any>; }>; /** * Get entities from the entity set. * @param withCount Get the count of the entities. * @param options The options for the request. */ fetchMany(top: number, options?: ODataOptions & { withCount?: boolean; }): Observable<{ entities: T[]; annots: import("angular-odata").ODataEntitiesAnnotations<T>; } | { entities: T[]; annots: import("angular-odata").ODataEntitiesAnnotations<any>; }>; /** * Get an entity from the entity set. * @param key The entity key. * @param etag The etag for the entity. * @param options The options for the request. */ fetchOne(options?: ODataOptions & { etag?: string; }): Observable<{ entity: T | null; annots: import("angular-odata").ODataEntitiesAnnotations<T>; }>; /** * Create an entity in the entity set. * @param attrs The attributes for the entity. * @param options The options for the request. */ create(attrs: Partial<T>, options?: ODataOptions): Observable<ODataEntity<T>>; /** * Update an entity in the entity set. * @param key The entity key. * @param attrs The attributes for the entity. * @param etag The etag for the entity. * @param options The options for the request. */ update(key: EntityKey<T>, attrs: Partial<T>, options?: ODataOptions & { etag?: string; }): Observable<ODataEntity<T>>; /** * Patch an entity in the entity set. * @param key The entity key. * @param attrs The attributes for the entity. * @param etag The etag for the entity. * @param options The options for the request. */ modify(key: EntityKey<T>, attrs: Partial<T>, options?: ODataOptions & { etag?: string; }): Observable<ODataEntity<T>>; /** * Delete an entity in the entity set. * @param key The entity key. * @param etag The etag for the entity. * @param options The options for the request. */ destroy(key: EntityKey<T>, options?: ODataOptions & { etag?: string; }): Observable<any>; /** * Get or create an entity in the entity set. * @param key The entity key. * @param attrs The attributes for the entity. * @param etag The etag for the entity. * @param options The options for the request. */ fetchOrCreate(key: EntityKey<T>, attrs: Partial<T>, { etag, ...options }?: { etag?: string; } & ODataOptions): Observable<ODataEntity<T>>; /** * Save an entity in the entity set. * @param attrs The attributes for the entity. * @param method The method to use. * @param etag The etag for the entity. * @param options The options for the request. */ save(attrs: Partial<T>, { etag, method, ...options }?: { etag?: string; method?: 'create' | 'update' | 'modify'; } & ODataOptions): Observable<ODataEntity<T>>; }