export type UpdateCustomUrlDto = {widgetId?: string | undefined, url?: string | undefined, websiteTitle?: string | undefined, backgroundColor?: string | undefined, textColor?: string | undefined}; export type PatchApiV1AdminCustomUrlsCustomUrlIdArgs = {customUrlId: string, body: UpdateCustomUrlDto}; export type PatchApiV1AdminCustomUrlsCustomUrlIdOptions = {baseUrl: string, accessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /v1/admin/custom-urls/{customUrlId} */ export const patchApiV1AdminCustomUrlsCustomUrlId = async (args: PatchApiV1AdminCustomUrlsCustomUrlIdArgs, options: PatchApiV1AdminCustomUrlsCustomUrlIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, accessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (accessToken !== undefined) headers.set('authorization', `Bearer ${accessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/admin/custom-urls/${encodeURIComponent(String(args.customUrlId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };