export type CreateApiV1SalecreditsSendIdArgs = {id: number, body: Array}; export type CreateApiV1SalecreditsSendIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send an credit * * POST /v1/salecredits/send/{id} */ export const createApiV1SalecreditsSendId = async (args: CreateApiV1SalecreditsSendIdArgs, options?: CreateApiV1SalecreditsSendIdOptions) => { const {baseUrl = "https://api.altoviz.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/salecredits/send/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };