export type GetApiV20VoicegatewaySpeechcredentialsVoicesArgs = {Accept?: ('application/json' | 'application/hal+json' | 'application/xml' | 'text/xml' | 'text/csv') | undefined, vendor: string, label?: string | undefined}; export type GetApiV20VoicegatewaySpeechcredentialsVoicesOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Voice Gateway Supported Voices * * GET /v2.0/voicegateway/speechcredentials/voices * * Also accepts auth: APIKeyQueryParam, CXoneTokenHeader, OAuth2 */ export const getApiV20VoicegatewaySpeechcredentialsVoices = async (args: GetApiV20VoicegatewaySpeechcredentialsVoicesArgs, options?: GetApiV20VoicegatewaySpeechcredentialsVoicesOptions) => { const {baseUrl = "https://api-trial.cognigy.ai/testing", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (args.vendor != null) query.append("vendor", String(args.vendor)) if (args.label != null) query.append("label", String(args.label)) if (APIKeyHeader !== undefined) headers.set("X-API-Key", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v2.0/voicegateway/speechcredentials/voices${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };