Returns list of all organization invitations.
1
//native
2
type Clickhouse = {
3
username: string;
4
password: string;
5
host: string;
6
};
7
/**
8
* List all invitations
9
* Returns list of all organization invitations.
10
*/
11
export async function main(auth: Clickhouse, organizationId: string) {
12
const url = new URL(
13
`https://api.clickhouse.cloud/v1/organizations/${organizationId}/invitations`
14
);
15
16
const response = await fetch(url, {
17
method: "GET",
18
headers: {
19
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
20
},
21
body: undefined,
22
});
23
if (!response.ok) {
24
const text = await response.text();
25
throw new Error(`${response.status} ${text}`);
26
}
27
return await response.json();
28
29