type Github = {
token: string;
};
/**
* Delete an email address for the authenticated user
* This endpoint is accessible with the `user` scope.
*/
export async function main(
auth: Github,
body: { emails: string[]; [k: string]: unknown } | string[] | string
) {
const url = new URL(`https://api.github.com/user/emails`);
const response = await fetch(url, {
method: "DELETE",
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;
};
/**
* Delete an email address for the authenticated user
* This endpoint is accessible with the `user` scope.
*/
export async function main(
auth: Github,
body: { emails: string[]; [k: string]: unknown } | string[] | string
) {
const url = new URL(`https://api.github.com/user/emails`);
const response = await fetch(url, {
method: "DELETE",
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