Update an organization you own or are a member of.
1
//native
2
type Turso = {
3
apiToken: string
4
}
5
6
export async function main(resource: Turso, organizationSlug: string, overages: boolean) {
7
const endpoint = `https://api.turso.tech/v1/organizations/${organizationSlug}`
8
9
const body = { overages }
10
11
const response = await fetch(endpoint, {
12
method: 'PATCH',
13
headers: {
14
Authorization: `Bearer ${resource.apiToken}`,
15
'Content-Type': 'application/json'
16
},
17
body: JSON.stringify(body)
18
})
19
20
if (!response.ok) {
21
throw new Error(`HTTP error! status: ${response.status}`)
22
23
24
const data = await response.json()
25
26
return data.organization
27
28