type Github = {
token: string;
};
/**
* Create an organization invitation
* Invite people to an organization by using their GitHub user ID or their email address.
*/
export async function main(
auth: Github,
org: string,
body: {
email?: string;
invitee_id?: number;
role?: "admin" | "direct_member" | "billing_manager";
team_ids?: number[];
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/orgs/${org}/invitations`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 367 days ago
type Github = {
token: string;
};
/**
* Create an organization invitation
* Invite people to an organization by using their GitHub user ID or their email address.
*/
export async function main(
auth: Github,
org: string,
body: {
email?: string;
invitee_id?: number;
role?: "admin" | "direct_member" | "billing_manager";
team_ids?: number[];
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/orgs/${org}/invitations`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 927 days ago