//native
type Vectara = {
apiKey: string
}
/**
* Reset the password for a user
* Reset the password for a user.
*/
export async function main(auth: Vectara, username: string) {
const url = new URL(`https://api.vectara.io/v2/users/${username}/reset_password`)
const response = await fetch(url, {
method: 'POST',
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.text()
}
Submitted by hugo697 581 days ago