//native
type Xata = {
apiKey: string
}
/**
* Updates an existing invite
* This operation provides a way to update an existing invite. Updates are performed in-place; they do not change the invite link, the expiry time, nor do they re-notify the recipient of the invite.
*/
export async function main(
auth: Xata,
workspace_id: string,
invite_id: string,
body: { role: 'owner' | 'maintainer' }
) {
const url = new URL(`https://api.xata.io/workspaces/${workspace_id}/invites/${invite_id}`)
const response = await fetch(url, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 428 days ago