/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as operations from "../models/operations/index.js"; import { APIPromise } from "../types/async.js"; import { unwrapAsync } from "../types/fp.js"; import { PageIterator, unwrapResultIterator } from "../types/operations.js"; let accountingCreditNotesList$module: | Promise | undefined; const accountingCreditNotesList = (( ...args: Parameters< typeof import("../funcs/accountingCreditNotesList.js").accountingCreditNotesList > ) => new APIPromise( (accountingCreditNotesList$module ??= import( "../funcs/accountingCreditNotesList.js" ).catch((error: unknown) => { accountingCreditNotesList$module = undefined; throw error; })).then((module) => module.accountingCreditNotesList(...args).$inspect() ), )) as typeof import("../funcs/accountingCreditNotesList.js").accountingCreditNotesList; let accountingCreditNotesCreate$module: | Promise | undefined; const accountingCreditNotesCreate = (( ...args: Parameters< typeof import("../funcs/accountingCreditNotesCreate.js").accountingCreditNotesCreate > ) => new APIPromise( (accountingCreditNotesCreate$module ??= import( "../funcs/accountingCreditNotesCreate.js" ).catch((error: unknown) => { accountingCreditNotesCreate$module = undefined; throw error; })).then((module) => module.accountingCreditNotesCreate(...args).$inspect() ), )) as typeof import("../funcs/accountingCreditNotesCreate.js").accountingCreditNotesCreate; let accountingCreditNotesGet$module: | Promise | undefined; const accountingCreditNotesGet = (( ...args: Parameters< typeof import("../funcs/accountingCreditNotesGet.js").accountingCreditNotesGet > ) => new APIPromise( (accountingCreditNotesGet$module ??= import( "../funcs/accountingCreditNotesGet.js" ).catch((error: unknown) => { accountingCreditNotesGet$module = undefined; throw error; })).then((module) => module.accountingCreditNotesGet(...args).$inspect()), )) as typeof import("../funcs/accountingCreditNotesGet.js").accountingCreditNotesGet; let accountingCreditNotesUpdate$module: | Promise | undefined; const accountingCreditNotesUpdate = (( ...args: Parameters< typeof import("../funcs/accountingCreditNotesUpdate.js").accountingCreditNotesUpdate > ) => new APIPromise( (accountingCreditNotesUpdate$module ??= import( "../funcs/accountingCreditNotesUpdate.js" ).catch((error: unknown) => { accountingCreditNotesUpdate$module = undefined; throw error; })).then((module) => module.accountingCreditNotesUpdate(...args).$inspect() ), )) as typeof import("../funcs/accountingCreditNotesUpdate.js").accountingCreditNotesUpdate; let accountingCreditNotesDelete$module: | Promise | undefined; const accountingCreditNotesDelete = (( ...args: Parameters< typeof import("../funcs/accountingCreditNotesDelete.js").accountingCreditNotesDelete > ) => new APIPromise( (accountingCreditNotesDelete$module ??= import( "../funcs/accountingCreditNotesDelete.js" ).catch((error: unknown) => { accountingCreditNotesDelete$module = undefined; throw error; })).then((module) => module.accountingCreditNotesDelete(...args).$inspect() ), )) as typeof import("../funcs/accountingCreditNotesDelete.js").accountingCreditNotesDelete; let accountingCreditNotesCreateBatch$module: | Promise | undefined; const accountingCreditNotesCreateBatch = (( ...args: Parameters< typeof import("../funcs/accountingCreditNotesCreateBatch.js").accountingCreditNotesCreateBatch > ) => new APIPromise( (accountingCreditNotesCreateBatch$module ??= import( "../funcs/accountingCreditNotesCreateBatch.js" ).catch((error: unknown) => { accountingCreditNotesCreateBatch$module = undefined; throw error; })).then((module) => module.accountingCreditNotesCreateBatch(...args).$inspect() ), )) as typeof import("../funcs/accountingCreditNotesCreateBatch.js").accountingCreditNotesCreateBatch; export class CreditNotes extends ClientSDK { /** * List Credit Notes * * @remarks * List Credit Notes */ async list( request: operations.AccountingCreditNotesAllRequest, options?: RequestOptions, ): Promise< PageIterator< operations.AccountingCreditNotesAllResponse, { cursor: string } > > { return unwrapResultIterator(accountingCreditNotesList( this, request, options, )); } /** * Create Credit Note * * @remarks * Create Credit Note */ async create( request: operations.AccountingCreditNotesAddRequest, options?: RequestOptions, ): Promise { return unwrapAsync(accountingCreditNotesCreate( this, request, options, )); } /** * Get Credit Note * * @remarks * Get Credit Note */ async get( request: operations.AccountingCreditNotesOneRequest, options?: RequestOptions, ): Promise { return unwrapAsync(accountingCreditNotesGet( this, request, options, )); } /** * Update Credit Note * * @remarks * Update Credit Note */ async update( request: operations.AccountingCreditNotesUpdateRequest, options?: RequestOptions, ): Promise { return unwrapAsync(accountingCreditNotesUpdate( this, request, options, )); } /** * Delete Credit Note * * @remarks * Delete Credit Note */ async delete( request: operations.AccountingCreditNotesDeleteRequest, options?: RequestOptions, ): Promise { return unwrapAsync(accountingCreditNotesDelete( this, request, options, )); } /** * Create Credit Notes in batch * * @remarks * Create multiple credit notes in a single request. Each item is processed independently, so some may be created while others fail; the response returns `200` with one result per item, in the order the items were sent. The maximum number of items accepted per request depends on the connector. */ async createBatch( request: operations.AccountingCreditNotesBatchAddRequest, options?: RequestOptions, ): Promise { return unwrapAsync(accountingCreditNotesCreateBatch( this, request, options, )); } }