//native
type Clickhouse = {
username: string;
password: string;
host: string;
};
/**
* List organization members
* Returns a list of all members in the organization.
*/
export async function main(auth: Clickhouse, organizationId: string) {
const url = new URL(
`https://api.clickhouse.cloud/v1/organizations/${organizationId}/members`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 141 days ago