angular-odata
Version:
Client side OData typescript library for Angular
614 lines (613 loc) • 26 kB
TypeScript
import { HttpClient, HttpEvent } from '@angular/common/http';
import { Observable } from 'rxjs';
import { ODataApi } from './api';
import { ODataConfigLoader } from './loaders';
import { ODataCollection, ODataModel } from './models/index';
import { ODataActionResource, ODataBatchResource, ODataEntityResource, ODataEntitySetResource, ODataFunctionResource, ODataMetadataResource, ODataNavigationPropertyResource, ODataOptions, ODataResource, ODataResponse, ODataSegment, ODataSingletonResource } from './resources/index';
import { ODataSettings } from './settings';
import * as i0 from "@angular/core";
export declare class ODataClient {
private http;
private loader;
settings?: ODataSettings;
constructor(http: HttpClient, loader: ODataConfigLoader);
/**
* Resolve the api for the given value.
* Where value is: string type or an string name or an instance of resource.
* @param value The value to resolve.
* @returns The api for the value.
*/
apiFor(value?: ODataResource<any> | string): ODataApi;
defaultApi(): ODataApi;
/**
* Resolve the parser for the given string type.
* @param type The string type of the parser.
* @returns The parser for the given type.
*/
parserForType<T>(type: string): import("angular-odata").Parser<T>;
/**
* Resolve the enum type for the given string type.
* @param type The string type of the enum type.
* @returns The enum type for the given type.
*/
enumTypeForType<T>(type: string): import("angular-odata").ODataEnumType<T>;
/**
* Resolve the structured type for the given string type.
* @param type The string type of the structured type.
* @returns The structured type for the given type.
*/
structuredTypeForType<T>(type: string): import("angular-odata").ODataStructuredType<T>;
/**
* Resolve the callable for the given string type.
* @param type The string type of the callable.
* @returns The callable for the given type.
*/
callableForType<T>(type: string): import("angular-odata").ODataCallable<T>;
/**
* Resolve the entity set for the given string type.
* @param type The string type of the entity set.
* @returns The entity set for the given type.
*/
entitySetForType(type: string): import("angular-odata").ODataEntitySet;
/**
* Resolve the model for the given string type.
* @param type The string type of the model.
* @returns The model for the given type.
*/
modelForType(type: string): typeof ODataModel;
/**
* Resolve the collection for the given string type.
* @param type The string type of the collection.
* @returns The collection for the given type.
*/
collectionForType(type: string): typeof ODataCollection;
fromJson<E>(json: {
segments: ODataSegment[];
options: {
[name: string]: any;
};
}, apiNameOrType?: string): ODataEntityResource<E> | ODataEntitySetResource<E> | ODataNavigationPropertyResource<E> | ODataSingletonResource<E>;
/**
* Build a resource for the metadata.
* @param apiName The name of the API.
* @returns The metadata resource.
*/
metadata(apiName?: string): ODataMetadataResource;
/**
* Build a resource for the batch.
* @param apiName The name of the API.
* @returns The batch resource.
*/
batch(apiName?: string): ODataBatchResource;
/**
* Build a resource for the singleton.
* @param path The full path to the singleton.
* @param apiNameOrType The name of the API or the type of the singleton.
* @returns The singleton resource.
*/
singleton<T>(path: string, apiNameOrType?: string): ODataSingletonResource<T>;
/**
* Build a resource for the entity set.
* @param path The full path to the entity set.
* @param apiNameOrType The name of the API or the type of the entity set.
* @returns The entity set resource.
*/
entitySet<T>(path: string, apiNameOrType?: string): ODataEntitySetResource<T>;
/**
* Build a resource for unbound action.
* @param path The full path to the action.
* @param apiNameOrType The name of the API or the type of the entity.
* @returns The unbound action resource.
*/
action<P, R>(path: string, apiNameOrType?: string): ODataActionResource<P, R>;
/**
* Build a resource for unbound function.
* @param path The full path to the function.
* @param apiNameOrType The name of the API or the type of the callable.
* @returns The unbound function resource.
*/
function<P, R>(path: string, apiNameOrType?: string): ODataFunctionResource<P, R>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe?: 'body';
responseType: 'arraybuffer';
}): Observable<ArrayBuffer>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe?: 'body';
responseType: 'blob';
}): Observable<Blob>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe?: 'body';
responseType: 'text';
}): Observable<string>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe: 'events';
responseType: 'arraybuffer';
}): Observable<HttpEvent<ArrayBuffer>>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe: 'events';
responseType: 'blob';
}): Observable<HttpEvent<Blob>>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe: 'events';
responseType: 'text';
}): Observable<HttpEvent<string>>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<any>>;
request<R>(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<R>>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe: 'response';
responseType: 'arraybuffer';
}): Observable<ODataResponse<ArrayBuffer>>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe: 'response';
responseType: 'blob';
}): Observable<ODataResponse<Blob>>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe: 'response';
responseType: 'text';
}): Observable<ODataResponse<string>>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<Object>>;
request<R>(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<R>>;
request(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe?: 'body';
responseType?: 'json';
}): Observable<Object>;
request<R>(method: string, resource: ODataResource<any>, options: ODataOptions & {
body: any | null;
observe?: 'body';
responseType?: 'json';
}): Observable<R>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'arraybuffer';
}): Observable<ArrayBuffer>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'blob';
}): Observable<Blob>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'text';
}): Observable<string>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'arraybuffer';
}): Observable<HttpEvent<ArrayBuffer>>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'blob';
}): Observable<HttpEvent<Blob>>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'text';
}): Observable<HttpEvent<string>>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<Object>>;
delete<T>(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<T>>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'arraybuffer';
}): Observable<ODataResponse<ArrayBuffer>>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'blob';
}): Observable<ODataResponse<Blob>>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'text';
}): Observable<ODataResponse<string>>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<Object>>;
delete<T>(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<T>>;
delete(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<Object>;
delete<T>(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<T>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'arraybuffer';
}): Observable<ArrayBuffer>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'blob';
}): Observable<Blob>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'text';
}): Observable<string>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'arraybuffer';
}): Observable<HttpEvent<ArrayBuffer>>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'blob';
}): Observable<HttpEvent<Blob>>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'text';
}): Observable<HttpEvent<string>>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<Object>>;
get<T>(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<T>>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'arraybuffer';
}): Observable<ODataResponse<ArrayBuffer>>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'blob';
}): Observable<ODataResponse<Blob>>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'text';
}): Observable<ODataResponse<string>>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<Object>>;
get<T>(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<T>>;
get(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<Object>;
get<T>(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<T>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'arraybuffer';
}): Observable<ArrayBuffer>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'blob';
}): Observable<Blob>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'text';
}): Observable<string>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'arraybuffer';
}): Observable<HttpEvent<ArrayBuffer>>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'blob';
}): Observable<HttpEvent<Blob>>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'text';
}): Observable<HttpEvent<string>>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<Object>>;
head<T>(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<T>>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'arraybuffer';
}): Observable<ODataResponse<ArrayBuffer>>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'blob';
}): Observable<ODataResponse<Blob>>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'text';
}): Observable<ODataResponse<string>>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<Object>>;
head<T>(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<T>>;
head(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<Object>;
head<T>(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<T>;
jsonp(resource: ODataResource<any>, callbackParam: string): Observable<Object>;
jsonp<T>(resource: ODataResource<any>, callbackParam: string): Observable<T>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'arraybuffer';
}): Observable<ArrayBuffer>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'blob';
}): Observable<Blob>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType: 'text';
}): Observable<string>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'arraybuffer';
}): Observable<HttpEvent<ArrayBuffer>>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'blob';
}): Observable<HttpEvent<Blob>>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType: 'text';
}): Observable<HttpEvent<string>>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<Object>>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<Object>>;
options<T>(resource: ODataResource<any>, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<T>>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'arraybuffer';
}): Observable<ODataResponse<ArrayBuffer>>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'blob';
}): Observable<ODataResponse<Blob>>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType: 'text';
}): Observable<ODataResponse<string>>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<Object>>;
options<T>(resource: ODataResource<any>, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<T>>;
options(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<Object>;
options<T>(resource: ODataResource<any>, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<T>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType: 'arraybuffer';
}): Observable<ArrayBuffer>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType: 'blob';
}): Observable<Blob>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType: 'text';
}): Observable<string>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType: 'arraybuffer';
}): Observable<HttpEvent<ArrayBuffer>>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType: 'blob';
}): Observable<HttpEvent<Blob>>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType: 'text';
}): Observable<HttpEvent<string>>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<Object>>;
patch<T>(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<T>>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType: 'arraybuffer';
}): Observable<ODataResponse<ArrayBuffer>>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType: 'blob';
}): Observable<ODataResponse<Blob>>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType: 'text';
}): Observable<ODataResponse<string>>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<Object>>;
patch<T>(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<T>>;
patch(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<Object>;
patch<T>(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<T>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType: 'arraybuffer';
}): Observable<ArrayBuffer>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType: 'blob';
}): Observable<Blob>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType: 'text';
}): Observable<string>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType: 'arraybuffer';
}): Observable<HttpEvent<ArrayBuffer>>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType: 'blob';
}): Observable<HttpEvent<Blob>>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType: 'text';
}): Observable<HttpEvent<string>>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<Object>>;
post<T>(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<T>>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType: 'arraybuffer';
}): Observable<ODataResponse<ArrayBuffer>>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType: 'blob';
}): Observable<ODataResponse<Blob>>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType: 'text';
}): Observable<ODataResponse<string>>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<Object>>;
post<T>(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<T>>;
post(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<Object>;
post<T>(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<T>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType: 'arraybuffer';
}): Observable<ArrayBuffer>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType: 'blob';
}): Observable<Blob>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType: 'text';
}): Observable<string>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType: 'arraybuffer';
}): Observable<HttpEvent<ArrayBuffer>>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType: 'blob';
}): Observable<HttpEvent<Blob>>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType: 'text';
}): Observable<HttpEvent<string>>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<Object>>;
put<T>(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'events';
responseType?: 'json';
}): Observable<HttpEvent<T>>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType: 'arraybuffer';
}): Observable<ODataResponse<ArrayBuffer>>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType: 'blob';
}): Observable<ODataResponse<Blob>>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType: 'text';
}): Observable<ODataResponse<string>>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<Object>>;
put<T>(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe: 'response';
responseType?: 'json';
}): Observable<ODataResponse<T>>;
put(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<Object>;
put<T>(resource: ODataResource<any>, body: any | null, options: ODataOptions & {
observe?: 'body';
responseType?: 'json';
}): Observable<T>;
static ɵfac: i0.ɵɵFactoryDeclaration<ODataClient, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ODataClient>;
}