//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: name || undefined,
description: description || undefined,
}),
},
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 9 days ago
//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(
description != null && description !== ""
? { email, name, description }
: { email, name }
),
},
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 10 days ago
//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 21 days ago