export type Webhook = {webhook_sid?: string | undefined, url: string, method?: ('get' | 'post') | undefined, username?: string | undefined, password?: string | undefined}; export type Account = {account_sid: string, name: string, sip_realm?: string | undefined, registration_hook?: Webhook | undefined, device_calling_application_sid?: string | undefined, service_provider_sid: string, record_all_calls?: boolean | undefined, record_format?: ('wav' | 'mp3') | undefined, bucket_credential?: ({vendor?: ('aws_s3' | 's3_compatible' | 'azure' | 'google') | undefined, region?: string | undefined, name?: string | undefined, access_key_id?: string | undefined, secret_access_key?: string | undefined}) | undefined}; export type UpdateApiAccountsAccountSidArgs = {body: Account}; export type UpdateApiAccountsAccountSidOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * update account * * PUT /Accounts/{AccountSid} */ export const updateApiAccountsAccountSid = async (args: UpdateApiAccountsAccountSidArgs, options?: UpdateApiAccountsAccountSidOptions) => { const {baseUrl = "https://api.jambonz.cloud/v1", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/Accounts/${encodeURIComponent(String(args.AccountSid))}${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 };