type Github = {
token: string;
};
/**
* Update the authenticated user
* **Note:** If your email is set to private and you send an `email` parameter as part of this request to update your profile, your privacy settings are still enforced: the email address will not be displayed on your public profile or via the API.
*/
export async function main(
auth: Github,
body: {
bio?: string;
blog?: string;
company?: string;
email?: string;
hireable?: boolean;
location?: string;
name?: string;
twitter_username?: string;
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/user`);
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 the authenticated user
* **Note:** If your email is set to private and you send an `email` parameter as part of this request to update your profile, your privacy settings are still enforced: the email address will not be displayed on your public profile or via the API.
*/
export async function main(
auth: Github,
body: {
bio?: string;
blog?: string;
company?: string;
email?: string;
hireable?: boolean;
location?: string;
name?: string;
twitter_username?: string;
[k: string]: unknown;
}
) {
const url = new URL(`https://api.github.com/user`);
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