export type UpdateApiApiV2Templates1Args = {body: Record}; export type UpdateApiApiV2Templates1Options = {baseUrl?: string | undefined, apikeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Atualizar Template * * PUT /api/v2/templates/1 */ export const updateApiApiV2Templates1 = async (args: UpdateApiApiV2Templates1Args, options?: UpdateApiApiV2Templates1Options) => { const {baseUrl = "https://cloud-hom.bry.com.br", fetch: fetchFn = fetch, apikeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (apikeyAuth !== undefined) headers.set('authorization', `apikey ${apikeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/templates/1${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 (await res.json()) as unknown };