export type PatchApiApiV1PurchaseOrdersIdActionsReleaseArgs = {id: string, body: BodyInit}; export type PatchApiApiV1PurchaseOrdersIdActionsReleaseOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Release purchase order * * PATCH /api/v1/purchaseOrders/{id}/actions/release */ export const patchApiApiV1PurchaseOrdersIdActionsRelease = async (args: PatchApiApiV1PurchaseOrdersIdActionsReleaseArgs, options?: PatchApiApiV1PurchaseOrdersIdActionsReleaseOptions) => { const {baseUrl = "https://xentral.xentral.biz", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "*/*") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/purchaseOrders/${encodeURIComponent(String(args.id))}/actions/release${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };