0

Get a user

by
Published Aug 26, 2022

Provides publicly available information about someone with a GitHub account.

Script github Verified

The script

Submitted by hugo989 Bun
Verified 6 days ago
1
import { Octokit } from "@octokit/rest";
2

3
type Github = {
4
  token: string;
5
};
6
export async function main(gh_auth: Github, username: string) {
7
  const octokit = new Octokit({ auth: gh_auth.token });
8

9
  return await octokit.request("GET /users/{username}", {
10
    username,
11
    headers: {
12
      "X-GitHub-Api-Version": "2022-11-28",
13
      Accept: "application/vnd.github+json",
14
    },
15
  });
16
}
17

Other submissions
  • Submitted by adam186 Deno
    Created 398 days ago
    1
    import { Octokit } from "https://cdn.skypack.dev/@octokit/rest";
    2
    
    
    3
    type Github = {
    4
      token: string;
    5
    };
    6
    export async function main(gh_auth: Github, username: string) {
    7
      const octokit = new Octokit({ auth: gh_auth.token });
    8
    
    
    9
      return await octokit.request("GET /users/{username}", {
    10
        username,
    11
        headers: {
    12
          "X-GitHub-Api-Version": "2022-11-28",
    13
          Accept: "application/vnd.github+json",
    14
        },
    15
      });
    16
    }
    17
    
    
  • Submitted by lplit Deno
    Created 1160 days ago
    1
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
    2
    import { Octokit } from "https://cdn.skypack.dev/@octokit/rest";
    3
    
    
    4
    /*
    5
    @param: {wmill.Resource<"github">} gh_auth - Resource containing Github Auth API Key
    6
    Example:
    7
    {
    8
      auth: github_api_key
    9
    }
    10
    */
    11
    export async function main(
    12
      gh_auth: wmill.Resource<"github">,
    13
      username: string,
    14
    ) {
    15
      const octokit = new Octokit({ auth: gh_auth.token });
    16
      const response = await octokit.rest.users.getByUsername({
    17
        username: username,
    18
      });
    19
    
    
    20
      return response;
    21
    }
    22