type Github = {
token: string;
};
/**
* Update a team (Legacy)
* **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a team](https://docs.github.com/rest/reference/teams#update-a-team) endpoint.
To edit a team, the authenticated user must either be an organization owner or a team maintainer.
**Note:** With nested teams, the `privacy` for parent teams cannot be `secret`.
*/
export async function main(
auth: Github,
team_id: string,
body: {
description?: string;
name: string;
parent_team_id?: number;
permission?: "pull" | "push" | "admin";
privacy?: "secret" | "closed";
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/teams/${team_id}`);
const response = await fetch(url, {
method: "PATCH",
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;
};
/**
* Update a team (Legacy)
* **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a team](https://docs.github.com/rest/reference/teams#update-a-team) endpoint.
To edit a team, the authenticated user must either be an organization owner or a team maintainer.
**Note:** With nested teams, the `privacy` for parent teams cannot be `secret`.
*/
export async function main(
auth: Github,
team_id: string,
body: {
description?: string;
name: string;
parent_team_id?: number;
permission?: "pull" | "push" | "admin";
privacy?: "secret" | "closed";
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/teams/${team_id}`);
const response = await fetch(url, {
method: "PATCH",
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