//native
type Deepl = {
apiKey: string;
baseUrl: string;
};
/**
* Retrieve Glossary Entries
* List the entries of a single glossary in the format specified by the `Accept` header.
*/
export async function main(auth: Deepl, glossary_id: string, Accept: string) {
const url = new URL(
`${auth.baseUrl}/v2/glossaries/${glossary_id}/entries`,
);
const response = await fetch(url, {
method: "GET",
headers: {
Accept: Accept,
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.text();
}
Submitted by hugo697 428 days ago