Search
Code212
// 自作コードからのfetch呼び出し (Requestオブジェクト)console.log(bold("\n--- My code fetch (Request object) ---"));const myRequest = new Request("https://api.github.com/users/denoland", { method: "GET", headers: {
// Fetch user data from GitHub const userResponse = await fetch("https://api.github.com/user", { headers: { "Authorization": `Bearer ${tokenData.access_token}`, // Fetch user email (might be private) const emailResponse = await fetch("https://api.github.com/user/emails", { headers: { "Authorization": `Bearer ${tokenData.access_token}`,
export class GitHubAPI { private baseURL = "https://api.github.com"; constructor(private accessToken: string) {}
// Get PR details const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`; let response; // Proceed with merge const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}/merge`; const response = await fetch(url, {
try { const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`; const response = await fetch(url, {
} const url = `https://api.github.com/repos/${repo}/issues/${issueNumber}`; const response = await fetch(url, { try { const url = `https://api.github.com/repos/${repo}/issues/${prNumber}/labels`; const response = await fetch(url, {
try { const url = `https://api.github.com/repos/${repo}/issues/${prNumber}/assignees`; const response = await fetch(url, {
try { const response = await fetch( `https://api.github.com/repos/${GITHUB_REPO}/actions/workflows/${GITHUB_WORKFLOW_ID}/dispatches`, { method: "POST",
} const response = await fetch(`https://api.github.com${endpoint}`, { headers }); repo: { name: "octocat/Hello-World", url: "https://api.github.com/repos/octocat/Hello-World" }, payload: { repo: { name: "github/docs", url: "https://api.github.com/repos/github/docs" }, payload: {}
async function fetchGitHubUserEmail(accessToken: string) { try { const emailRequest = await fetch("https://api.github.com/user/emails", { headers: { "Authorization": `Bearer ${accessToken}`,