//native
type Vectara = {
apiKey: string
}
/**
* Get a user
* Get a user and view details like thei email, username, and associated roles.
*/
export async function main(auth: Vectara, username: string) {
const url = new URL(`https://api.vectara.io/v2/users/${username}`)
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 581 days ago