export type UpdateApiApiServiceConfigV1WhatsArgs = {body: {provider: 'UBOTS', clientID: string, clientSecret: string, userName: string, fromPhone: string, templates?: ({idOtpPtBr?: string | undefined, idOtpEnUs?: string | undefined, idOtpEsCl?: string | undefined, idLinkPtBr?: string | undefined, idLinkEnUs?: string | undefined, idLinkEsCl?: string | undefined}) | undefined}}; export type UpdateApiApiServiceConfigV1WhatsOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Configuração de provedor próprio para envio das mensagens de WhatsApp da aplicação ⚠️ * * PUT /api/service/config/v1/whats */ export const updateApiApiServiceConfigV1Whats = async (args: UpdateApiApiServiceConfigV1WhatsArgs, options?: UpdateApiApiServiceConfigV1WhatsOptions) => { const {baseUrl = "https://cloud-hom.bry.com.br", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/service/config/v1/whats${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 undefined };