//native
type Vercel = {
token: string;
};
/**
* Request access to a team
* Request access to a team as a member. An owner has to approve the request. Only 10 users can request access to a team at the same time.
*/
export async function main(
auth: Vercel,
teamId: string,
body: {
joinedFrom: {
origin:
| "import"
| "teams"
| "github"
| "gitlab"
| "bitbucket"
| "feedback"
| "organization-teams";
commitId?: string;
repoId?: string;
repoPath?: string;
gitUserId?: string | number;
gitUserLogin?: string;
};
},
) {
const url = new URL(`https://api.vercel.com/v1/teams/${teamId}/request`);
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 428 days ago