//native
type Phrase = {
token: string
baseUrl: string
}
/**
* Get a single term
* Get details for a single term in the term base (previously: glossary).
*/
export async function main(auth: Phrase, account_id: string, glossary_id: string, id: string) {
const url = new URL(
`${auth.baseUrl}/accounts/${account_id}/glossaries/${glossary_id}/terms/${id}`
)
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'ApiToken ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago