export type SipServerUpsertRequest = {serverId?: (number | null) | undefined, serverName: string, queueName: string, ipAddress?: (string | null) | undefined, httpBaseUrl?: (string | null) | undefined, httpPort?: number | undefined, maxChannels?: number | undefined, status?: (string | null) | undefined, isActive?: boolean | undefined}; export type UpdateApiV1SipServersServerIdArgs = {serverId: number, body: SipServerUpsertRequest}; export type UpdateApiV1SipServersServerIdOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * PUT /v1/sip-servers/{serverId} * * Also accepts auth: API Key */ export const updateApiV1SipServersServerId = async (args: UpdateApiV1SipServersServerIdArgs, options: UpdateApiV1SipServersServerIdOptions) => { const {baseUrl, 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(/\/+$/, '')}/v1/sip-servers/${encodeURIComponent(String(args.serverId))}${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 };