export type CreateApiV1GiftcardsTemplatesCustomArgs = {body: {RAW_BODY?: unknown | undefined}}; export type CreateApiV1GiftcardsTemplatesCustomOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a gift card template with services or day packages * * POST /v1/giftcards/templates/custom */ export const createApiV1GiftcardsTemplatesCustom = async (args: CreateApiV1GiftcardsTemplatesCustomArgs, options?: CreateApiV1GiftcardsTemplatesCustomOptions) => { const {baseUrl = "https://api.zenoti.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "text/plain") const url = `${baseUrl.replace(/\/+$/, '')}/v1/giftcards/templates/custom${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 res.text() };