Netzo Logo

github

GitHub is a code hosting platform for version control and collaboration.

Usage

import { github } from 'netzo/apis/github.ts'

const api = github({
  personalAccessToken: Deno.env.get('GITHUB_PERSONAL_ACCESS_TOKEN'),
})

Configuration

The github factory function expects an object with the following, and returns an object with an API client api.

ParamTypeDefaultDescription
personalAccessTokenstringDeno.env.get('GITHUB_PERSONAL_ACCESS_TOKEN')the access token to use for authentication
Refer to the API documentation to get the required information.

Examples

The following examples assume you have created an api client instance.

Find users/organizations

Find all users and organizations matching the query.

const query: QueryUsers = {}
const resultData = await api.users.get<User[]>(query)

Get user/organization

Get a user or organization by username.

const resultData = await api.users[USERNAME].get<User[]>()

Find repositories of user

Find all repositories of a given user that match the query.

const query: QueryRepositories = {}
const resultData = await api.users[USERNAME].repos.get<Repository[]>(query)

Find repositories of organization

Find all repositories of a given organization that match the query.

const query: QueryRepositories = {}
const resultData = await api.orgs[ORG].repos.get<Repository[]>(query)

Find issues of repository

Find all issues of a given organization that match the query.

const query: QueryIssues = {}
const resultData = await api.repos[OWNER][REPO].issues.get<Issue[]>(query)

References