@odata2ts/odata-service
Version:
Main runtime dependency of odata2ts for generated odata client services
36 lines (35 loc) • 1.8 kB
TypeScript
import { ODataHttpClient, ODataHttpClientConfig, ODataResponse } from "@odata2ts/http-client-api";
import { ODataCollectionResponseV2, ODataEntityModelResponseV2 } from "@odata2ts/odata-core";
import { ODataQueryBuilderV2 } from "@odata2ts/odata-query-builder";
import { PrimitiveCollectionType, QueryObjectModel } from "@odata2ts/odata-query-objects";
import { ODataServiceOptions } from "../ODataServiceOptions";
import { ServiceStateHelperV2 } from "./ServiceStateHelperV2.js";
type PrimitiveExtractor<T> = T extends PrimitiveCollectionType<infer E> ? E : T;
export declare class CollectionServiceV2<in out ClientType extends ODataHttpClient, T, Q extends QueryObjectModel, EditableT = PrimitiveExtractor<T>> {
protected readonly __base: ServiceStateHelperV2<ClientType, Q>;
constructor(client: ClientType, basePath: string, name: string, qModel: Q, options?: ODataServiceOptions);
getPath(): string;
/**
* Add a new item to the collection.
*
* @param model primitive value
* @param requestConfig
*/
add(model: EditableT, requestConfig?: ODataHttpClientConfig<ClientType>): ODataResponse<ODataEntityModelResponseV2<T>>;
/**
* Update the whole collection.
*
* @param models set of primitive values
* @param requestConfig
*/
update(models: Array<EditableT>, requestConfig?: ODataHttpClientConfig<ClientType>): ODataResponse<void>;
/**
* Delete the whole collection.
*/
delete(requestConfig?: ODataHttpClientConfig<ClientType>): ODataResponse<void>;
/**
* Query collection.
*/
query<ReturnType = T>(queryFn?: (builder: ODataQueryBuilderV2<Q>, qObject: Q) => void, requestConfig?: ODataHttpClientConfig<ClientType>): ODataResponse<ODataCollectionResponseV2<ReturnType>>;
}
export {};