Options
All
  • Public
  • Public/Protected
  • All
Menu

Wrapper around a the Github API using the more generic octocat library.

Hierarchy

  • Github

Index

Constructors

constructor

  • new Github(token: string, owner: string, repo: string): Github
  • Parameters

    • token: string

      Github API Token

    • owner: string

      Repository Owner

    • repo: string

      Repository

    Returns Github

Methods

comment

  • comment(issue_number: number, body: string): Promise<void>
  • Add a comment to an (existing) issue

    Parameters

    • issue_number: number

      the number of the issue

    • body: string

      the comment

    Returns Promise<void>

create_issue

  • create_issue(issue: string): Promise<any>

get_assignees

  • get_assignees(): Promise<any[]>
  • Get the list of assignees' logins. The method takes care of paging.

    async

    Returns Promise<any[]>

    • list of github login names for the assignees

get_file

  • get_file(path: string, file_name: string): Promise<string>
  • Get (markdown) file

    async

    Parameters

    • path: string

      Path to the directory containing the file

    • file_name: string

      the file name within the directory

    Returns Promise<string>

    • the raw content of the file

get_json

  • get_json(path: string): Promise<any>
  • Get the JSON content of a repository content

    async

    Parameters

    • path: string

      Path to the content

    Returns Promise<any>

    • JSON content turned into an object

get_listing

  • get_listing(path: string, page_size?: number): Promise<any>
  • Get the listing of a directory in the repository

    async

    Parameters

    • path: string

      Path to the directory

    • Default value page_size: number = null

      Page size (defaults to null, ie, no page size set)

    Returns Promise<any>

    • Github API object for the listing

update

  • update(path: string, message: string, new_content: any, sha?: string): Promise<void>
  • Update a (JSON) content

    Parameters

    • path: string

      Path to the directory containing the file

    • message: string

      Message for the commit

    • new_content: any

      New content

    • Default value sha: string = undefined

      SHA value if this is an update, undefined if this is a new content

    Returns Promise<void>