import { D2SchemaProperties } from "../schemas"; import { D2ApiDefinitionBase, D2ApiResponse, ErrorReport, GetOptionValue, PartialModel, PartialPersistedModel } from "./common"; import { D2ApiGeneric } from "./d2Api"; import { D2ModelSchemaBase, GetFields, SelectedPick } from "./inference"; import { PatchOperation } from "./patch"; declare type ModelResponse = { responseType: "ObjectReport"; uid: string; klass: string; errorReports?: ErrorReport[]; }; export interface Pager { page: number; pageCount: number; total: number; pageSize: number; } export interface NonPaginatedObjects { objects: T[]; } export interface PaginatedObjects extends NonPaginatedObjects { pager: Pager; } export declare type GetOptions = GetOptionValue & Partial<{ page: number; pageSize: number; paging: boolean; order: string; rootJunction: "AND" | "OR"; }>; export interface UpdateOptions { preheatCache: boolean; strategy: "CREATE_AND_UPDATE" | "CREATE" | "UPDATE" | "DELETE"; mergeMode: "REPLACE" | "MERGE"; } export interface GetParams { fields?: string; filter?: string[]; pageSize?: number; paging?: boolean; order?: string; } declare type GetObject = SelectedPick>; export declare class Model { private d2Api; schema: D2SchemaProperties; constructor(d2Api: D2ApiGeneric, schema: D2SchemaProperties); get modelName(): D2ModelSchema["name"]; get & { paging?: true | undefined; }, Obj = GetObject>(options: Options): D2ApiResponse>; get & { paging?: false; }, Obj = GetObject>(options: Options): D2ApiResponse>; getById>(id: string, options: Options): D2ApiResponse>; post(payload: PartialModel, options?: Partial): D2ApiResponse; put(payload: PartialPersistedModel, options?: Partial): D2ApiResponse; patch(id: string, patchOperations: PatchOperation[], options?: Partial): D2ApiResponse; delete(payload: PartialPersistedModel): D2ApiResponse; } export {};