export type UpdateApiV2ServersServerNameVhostsVhostNameSdpfilesSdpfileNameActionsActionArgs = {serverName: string, action: 'connect', connectAppName?: string | undefined, appInstance?: string | undefined, mediaCasterType: 'rtp' | ' rtp-record' | 'shoutcast' | 'shoutcast-record' | 'liverepeater', vhostName: string, sdpfileName: string}; export type UpdateApiV2ServersServerNameVhostsVhostNameSdpfilesSdpfileNameActionsActionOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * SDP file actions * * PUT /v2/servers/{serverName}/vhosts/{vhostName}/sdpfiles/{sdpfileName}/actions/{action} */ export const updateApiV2ServersServerNameVhostsVhostNameSdpfilesSdpfileNameActionsAction = async (args: UpdateApiV2ServersServerNameVhostsVhostNameSdpfilesSdpfileNameActionsActionArgs, options?: UpdateApiV2ServersServerNameVhostsVhostNameSdpfilesSdpfileNameActionsActionOptions) => { const {baseUrl = "http://localhost:8087", fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.connectAppName != null) query.append("connectAppName", String(args.connectAppName)) if (args.appInstance != null) query.append("appInstance", String(args.appInstance)) if (args.mediaCasterType != null) query.append("mediaCasterType", String(args.mediaCasterType)) if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/servers/${encodeURIComponent(String(args.serverName))}/vhosts/${encodeURIComponent(String(args.vhostName))}/sdpfiles/${encodeURIComponent(String(args.sdpfileName))}/actions/${encodeURIComponent(String(args.action))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };