Class: Client

Client(givenTokenopt)

The Client class is a simple wrapper that initializes our GraphQL client with the auth token. Current implementation uses graphql-client.

Constructor

new Client(givenTokenopt)

Constructs a Client object.
Parameters:
Name Type Attributes Description
givenToken string <optional>
A GitHub authentication token to connect to the GitHub API. The token needs `public_repo` access. If a token is not provided, the program will attempt to read from a named file 'auth_token.txt' on the `src` directory. If none exists the constructor will crash.
Source:

Members

client :graphql-client

The API client, see documentation
Type:
  • graphql-client
Source:

token :string

The API token
Type:
  • string
Source:

Methods

(async) getAllIssues(pageSizeopt) → {Array.<IssueInfo2>}

Get all the issues in the project
Parameters:
Name Type Attributes Default Description
pageSize number <optional>
100 The number of issues per page
Source:
Returns:
Type
Array.<IssueInfo2>

getNumberOfCommitsByTime(startTimeopt, timeDeltaopt) → {Array.<CommitPeriodCount>}

Get total number of commits in Master branch in each time period
Parameters:
Name Type Attributes Default Description
startTime Date <optional>
moment().subtract(6, 'months') The start of the sampling period
timeDelta object <optional>
{days: 7} The timedelta of each period, see reference
Source:
Returns:
The number of commits in each period
Type
Array.<CommitPeriodCount>

getNumberOfCommitsInMaster() → {number}

Get total number of commits in Master branch
Source:
Returns:
The number of commits
Type
number

getNumberOfPullRequests() → {number}

Get number of pull requests of the project
Source:
Returns:
The number of pull requests
Type
number

getNumberOfStargazers() → {number}

Get number of stargazers of the project
Source:
Returns:
The number of stargazers
Type
number

query(Q, vars)

A simple wrapper for most common tasks client available through Client#client directly.
Parameters:
Name Type Description
Q string The GraphQL query.
vars object The variables to be replaced in the query.
Source: