export type SpeakerId = string; export type SpeakerVolume = number; export type CreateApiV1SpeakersIdTestSoundArgs = {id: SpeakerId, body: {volume?: SpeakerVolume | undefined}}; export type CreateApiV1SpeakersIdTestSoundOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Test speaker sound * * POST /v1/speakers/{id}/test-sound */ export const createApiV1SpeakersIdTestSound = async (args: CreateApiV1SpeakersIdTestSoundArgs, options?: CreateApiV1SpeakersIdTestSoundOptions) => { const {baseUrl = "https://api.ui.com/v1/connector/consoles/942A6FF664C0000000000964970E0000000009E710560000000068A9873F:9999999999/proxy/protect/integration", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/speakers/${encodeURIComponent(String(args.id))}/test-sound${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };