//native
type Deepl = {
apiKey: string;
baseUrl: string;
};
/**
* List all Glossaries
* List all glossaries and their meta-information, but not the glossary entries.
*/
export async function main(auth: Deepl) {
const url = new URL(`${auth.baseUrl}/v2/glossaries`);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "DeepL-Auth-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