UNPKG

@eldev/business-central-api

Version:

A Dynamics 365 Business Central client for TypeScript

29 lines 1.46 kB
import type { UUID } from "node:crypto"; import type { BCClient } from "../client/client.js"; import type { StandardSchemaV1 } from "../validation/standard-schema.js"; export type PaginationOpts = { maxResults?: number; serverPageLimit?: number; }; /** A query string of OData properties. */ export type ODataQuery = string; /** ApiPage represents an API Page for a collection. * It uses the Standard Schema of an individual row result. * It has full CRUD functionality. */ export declare class ApiPage<T, TCreate = unknown, TUpdate = unknown, TActions extends string = string> { #private; readonly endpoint: string; readonly client: BCClient; constructor(client: BCClient, endpoint: string, schema: StandardSchemaV1<unknown, T>); withCommands<TNewCreate, TNewUpdate, TNewActions extends string = string>(): ApiPage<T, TNewCreate, TNewUpdate, TNewActions>; getById(id: string, query?: ODataQuery): Promise<T>; list(query?: ODataQuery, pOpts?: PaginationOpts): AsyncIterableIterator<T>; findOne(query: ODataQuery): Promise<T | null>; update(id: string | UUID, updateCommand: TUpdate, query?: ODataQuery): Promise<T>; create(createCommand: TCreate, query?: ODataQuery): Promise<T>; delete(id: string): Promise<void>; /** Executes a bound action. Use the withCommands method to add types to give options. */ action(id: string, action: TActions): Promise<void>; } //# sourceMappingURL=api-page.d.ts.map