export type Webhook = {webhook_sid?: string | undefined, url: string, method?: ('get' | 'post') | undefined, username?: string | undefined, password?: string | undefined}; export type ServiceProvider = {service_provider_sid: string, name: string, description?: string | undefined, root_domain?: string | undefined, registration_hook?: Webhook | undefined, ms_teams_fqdn?: string | undefined, test_number?: string | undefined, test_application_name?: string | undefined, test_application_sid?: string | undefined}; export type UpdateApiServiceProvidersServiceProviderSidArgs = {body: ServiceProvider}; export type UpdateApiServiceProvidersServiceProviderSidOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * update service provider * * PUT /ServiceProviders/{ServiceProviderSid} */ export const updateApiServiceProvidersServiceProviderSid = async (args: UpdateApiServiceProvidersServiceProviderSidArgs, options?: UpdateApiServiceProvidersServiceProviderSidOptions) => { 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(/\/+$/, '')}/ServiceProviders/${encodeURIComponent(String(args.ServiceProviderSid))}${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 };