//native
type Ultravox = {
apiKey: string;
};
/**
* Schema retrieve
* OpenApi3 schema for this API. Format can be selected via content negotiation.
- YAML: application/vnd.oai.openapi
- JSON: application/vnd.oai.openapi+json
*/
export async function main(
auth: Ultravox,
format: "json" | "yaml" | undefined,
lang:
| "af"
| "ar"
| "ar-dz"
| "ast"
| "az"
| "be"
| "bg"
| "bn"
| "br"
| "bs"
| "ca"
| "ckb"
| "cs"
| "cy"
| "da"
| "de"
| "dsb"
| "el"
| "en"
| "en-au"
| "en-gb"
| "eo"
| "es"
| "es-ar"
| "es-co"
| "es-mx"
| "es-ni"
| "es-ve"
| "et"
| "eu"
| "fa"
| "fi"
| "fr"
| "fy"
| "ga"
| "gd"
| "gl"
| "he"
| "hi"
| "hr"
| "hsb"
| "hu"
| "hy"
| "ia"
| "id"
| "ig"
| "io"
| "is"
| "it"
| "ja"
| "ka"
| "kab"
| "kk"
| "km"
| "kn"
| "ko"
| "ky"
| "lb"
| "lt"
| "lv"
| "mk"
| "ml"
| "mn"
| "mr"
| "ms"
| "my"
| "nb"
| "ne"
| "nl"
| "nn"
| "os"
| "pa"
| "pl"
| "pt"
| "pt-br"
| "ro"
| "ru"
| "sk"
| "sl"
| "sq"
| "sr"
| "sr-latn"
| "sv"
| "sw"
| "ta"
| "te"
| "tg"
| "th"
| "tk"
| "tr"
| "tt"
| "udm"
| "ug"
| "uk"
| "ur"
| "uz"
| "vi"
| "zh-hans"
| "zh-hant"
| undefined,
) {
const url = new URL(`https://api.ultravox.ai/api/schema/`);
for (const [k, v] of [
["format", format],
["lang", lang],
]) {
if (v !== undefined && v !== "" && k !== undefined) {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
"X-API-Key": auth.apiKey,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago