export type Webhook = {webhook_sid?: string | undefined, url: string, method?: ('get' | 'post') | undefined, username?: string | undefined, password?: string | undefined}; export type Application = {application_sid?: string | undefined, name: string, account_sid: string, call_hook?: Webhook | undefined, call_status_hook?: Webhook | undefined, messaging_hook?: Webhook | undefined, speech_synthesis_vendor?: string | undefined, speech_synthesis_voice?: string | undefined, speech_recognizer_vendor?: string | undefined, speech_recognizer_language?: string | undefined, env_vars?: Record | undefined, record_all_calls?: boolean | undefined}; export type UpdateApiApplicationsApplicationSidArgs = {body: Application}; export type UpdateApiApplicationsApplicationSidOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * update application * * PUT /Applications/{ApplicationSid} */ export const updateApiApplicationsApplicationSid = async (args: UpdateApiApplicationsApplicationSidArgs, options?: UpdateApiApplicationsApplicationSidOptions) => { 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(/\/+$/, '')}/Applications/${encodeURIComponent(String(args.ApplicationSid))}${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 };