//native
/**
* Create Group
* Create a group with the given email address (on one of the account's domains), display name and description.
*/
export async function main(
auth: RT.Gworkspace,
email: string,
name: string | undefined,
description: string | undefined,
) {
const response = await fetch(
"https://admin.googleapis.com/admin/directory/v1/groups",
{
method: "POST",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({ email, name, description }),
},
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 1 hour ago