Options
All
  • Public
  • Public/Protected
  • All
Menu

The Github service allows all interaction with Github. It implements both a ServiceListener that listens to webhooks and a ServiceEmitter that communicates with GH via its API.

Hierarchy

Implements

  • ServiceListener
  • ServiceEmitter

Index

Constructors

constructor

  • new GithubService(constObj: GithubListenerConstructor | GithubConstructor): GithubService
  • Constructor for both the ServiceListener and ServiceEmitter.

    Parameters

    • constObj: GithubListenerConstructor | GithubConstructor

      Construction object for either ServiceListener or ServiceEmitter.

    Returns GithubService

Properties

Private _serviceName

_serviceName: string = path.basename(__filename.split('.')[0])

Private appId

appId: number

Protected authToken

authToken: string

Private eventTriggers

eventTriggers: GithubRegistration[] = []

Protected getWorker

getWorker: function

Type declaration

Private ghApiAccept

ghApiAccept: string = "application/vnd.github.loki-preview+json"

Protected githubApi

githubApi: any

Private logger

logger: Logger = new Logger()

Protected pem

pem: string

Private userPat

userPat: string

Protected workers

workers: WorkerMap<string> = new Map<T, Worker<T>>()

Accessors

apiHandle

  • get apiHandle(): GithubHandle
  • Retrieve the Github SDK API handle.

    Returns GithubHandle

    Github SDK handle.

authenticationToken

  • get authenticationToken(): string
  • Retrieve the authentication token for Github Service.

    Returns string

    Current Github authentication token.

serviceName

  • get serviceName(): string
  • Get the name of the Github service.

    Returns string

    The name of the service.

Methods

Protected authenticate

  • authenticate(): Promise<void>
  • Authenticate against the Github API and Installation environment (for Integrations).

    Returns Promise<void>

    Promise fulfilled once authentication has occurred.

getConfigurationFile

  • getConfigurationFile(details: GithubConfigLocation): Promise<string | void>
  • Retrieve configuration file from a Github repository

    Parameters

    • details: GithubConfigLocation

      The location of the configuration file, including repository and file path.

    Returns Promise<string | void>

    A promise containing a string which is the contents of the configuration file.

Protected handleGithubEvent

  • handleGithubEvent(event: ServiceEvent): Promise<void>
  • Handles all Github events to trigger actions, should the parameters meet those registered.

    Parameters

    • event: ServiceEvent

      A ServiceEvent created from the event sent by Github.

    Returns Promise<void>

    Promise that is fulfilled once all processing of the event has completed.

Protected queueEvent

registerEvent

  • registerEvent(registration: GithubRegistration): void
  • Create a new event triggered action for the list.

    Parameters

    • registration: GithubRegistration

      A GithubRegistration object detailing the events required by the client.

    Returns void

Protected removeWorker

  • removeWorker(context: string): void

sendData

  • sendData(data: ServiceEmitRequest): Promise<ServiceEmitResponse>
  • Send data to Github. This method will automatically deal with paged requests. Should any passed data reference the per_page or page properties, these will be honoured, else page fetches will start at 0 with the default 30 entries per page Fetches will occur until there are no pages left to fetch.

    Parameters

    • data: ServiceEmitRequest

      A ServiceEmitRequest detailling the call to make and associated data.

    Returns Promise<ServiceEmitResponse>

    A ServiceEmitResponse comprised from the response from Github.

Generated using TypeDoc