angular-odata
Version:
Client side OData typescript library for Angular
75 lines (74 loc) • 2.9 kB
TypeScript
import { Observable } from 'rxjs';
import { ODataApi } from '../../api';
import { QueryOption } from '../../types';
import { ODataPathSegments } from '../path';
import { ODataResource } from '../resource';
import { ODataEntities, ODataEntity } from '../response';
import { ODataEntityResource } from './entity';
import { ODataEntitiesOptions, ODataEntityOptions, ODataOptions } from './options';
export declare class ODataReferenceResource<T> extends ODataResource<T> {
static factory<P>(api: ODataApi, { segments }: {
segments: ODataPathSegments;
}): ODataReferenceResource<P>;
clone(): ODataReferenceResource<T>;
protected post(target: ODataEntityResource<any>, options?: ODataOptions): Observable<any>;
protected put(target: ODataEntityResource<any>, options?: ODataOptions): Observable<any>;
protected delete({ etag, target, ...options }?: {
etag?: string;
target?: ODataEntityResource<any>;
} & ODataOptions): Observable<any>;
/**
* Add the given target to the collection.
* @param target The target resource
* @param options Options for the request
* @returns Observable of the response
*/
add(target: ODataEntityResource<any>, options?: ODataOptions): Observable<any>;
/**
* Remove the given target from the collection.
* @param target The target resource
* @param options Options for the request
* @returns Observable of the response
*/
remove(target?: ODataEntityResource<any>, options?: ODataOptions): Observable<any>;
/**
* Set the reference to the given target.
* @param target The target resource
* @param options Options for the request
* @returns Observable of the response
*/
set(target: ODataEntityResource<any>, options?: ODataOptions): Observable<any>;
/**
* Unset the reference to the given target.
* @param options Options for the request.
* @returns Observable of the response
*/
unset(options?: ODataOptions): Observable<any>;
/**
* Fetch entity / entities
* @param options Options for the request
* @return An observable of the entity or entities with annotations
*/
fetch(options?: ODataEntityOptions & {
bodyQueryOptions?: QueryOption[];
}): Observable<ODataEntity<T>>;
fetch(options?: ODataEntitiesOptions & {
bodyQueryOptions?: QueryOption[];
}): Observable<ODataEntities<T>>;
/**
* Fetch the entity
* @param options Options for the request
* @returns The entity
*/
fetchEntity(options?: ODataOptions & {
bodyQueryOptions?: QueryOption[];
}): Observable<T | null>;
/**
* Fetch entities
* @param options Options for the request
* @returns The entities
*/
fetchEntities(options?: ODataOptions & {
bodyQueryOptions?: QueryOption[];
}): Observable<T[] | null>;
}