type Github = {
token: string;
};
/**
* Add or update team project permissions (Legacy)
* **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API.
*/
export async function main(
auth: Github,
team_id: string,
project_id: string,
body: { permission?: "read" | "write" | "admin"; [k: string]: unknown }
) {
const url = new URL(
`https://api.github.com/teams/${team_id}/projects/${project_id}`
);
const response = await fetch(url, {
method: "PUT",
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.text();
}
Submitted by hugo697 367 days ago
type Github = {
token: string;
};
/**
* Add or update team project permissions (Legacy)
* **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API.
*/
export async function main(
auth: Github,
team_id: string,
project_id: string,
body: { permission?: "read" | "write" | "admin"; [k: string]: unknown }
) {
const url = new URL(
`https://api.github.com/teams/${team_id}/projects/${project_id}`
);
const response = await fetch(url, {
method: "PUT",
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.text();
}
Submitted by hugo697 927 days ago