Skip to content

Latest commit

 

History

History
305 lines (223 loc) · 13.7 KB

API.md

File metadata and controls

305 lines (223 loc) · 13.7 KB

src/index

Module providing GitHub API calls.

src/index~authenticate(gitHubOAuthToken) ⇒ Promise

Authenticate the user for making calls to GitHub, using their OAuth token. See https://developer.github.com/v3/#authentication

Kind: inner method of src/index

Param Type Description
gitHubOAuthToken String The OAuth token from GitHub

src/index~getDetailsForAuthenticatedUser() ⇒ Promise

Get the details associated with the currently authenticated user. See https://developer.github.com/v3/users/#get-the-authenticated-user

Kind: inner method of src/index

src/index~getDetailsForUser(username) ⇒ Promise

Get the details for a specific user. See https://developer.github.com/v3/users/#get-a-single-user

Kind: inner method of src/index

Param Type
username String

src/index~getReposForAuthenticatedUser(affiliation, page, per_page) ⇒ Promise

Get the repos the user has explicit permission to access. See https://developer.github.com/v3/repos/#list-your-repositories

Kind: inner method of src/index

Param Type Description
affiliation String User's relation to the repo
page Integer The page number
per_page Integer Repos per page

src/index~getReposForUser(username, page, per_page) ⇒ Promise

Get the repos for a specific user. See https://developer.github.com/v3/repos/#list-user-repositories

Kind: inner method of src/index

Param Type Description
username String The username
page Integer The page number
per_page Integer Repos per page

src/index~getDetailsForOrg(org) ⇒ Promise

Get the repos for a specific org. See https://developer.github.com/v3/repos/#list-organization-repositories

Kind: inner method of src/index

Param Type Description
org String The org name

src/index~getMembershipForUser(org, username) ⇒ Promise

Get organization membership for a user See https://docs.github.com/en/rest/reference/orgs#set-organization-membership-for-a-user

Kind: inner method of src/index

Param Type Description
org String The org name
username String The user name

src/index~getPermissionsForUser() ⇒ Promise

Get the permissions for a specific user and repo. See https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level

Kind: inner method of src/index

Param Type Description
req.owner String The repo owner
req.repo String The repo
req.username String The username

src/index~getTemplates(owner, repo, ref, path) ⇒ Promise

Get the CWRC Writer templates. Default location is https://github.com/cwrc/CWRC-Writer-Templates/tree/master/templates

Kind: inner method of src/index

Param Type Description
owner String The owner
repo String The repo
ref String The branch/tag
path String The path

src/index~getDoc(owner, repo, ref, path) ⇒ Promise

Get a document from GitHub. See https://developer.github.com/v3/repos/contents/#get-contents See https://octokit.github.io/rest.js/#octokit-routes-repos-get-contents

Kind: inner method of src/index

Param Type Description
owner String The owner
repo String The repo
ref String The branch/tag
path String The path

src/index~createRepo(repo, description, isPrivate) ⇒ Promise

Create a new repo for the authenticated user. See https://developer.github.com/v3/repos/#create

Kind: inner method of src/index

Param Type Description
repo String The repo
description String The repo description
isPrivate String | Boolean Is the repo private

src/index~renameRepo(repo, description, isPrivate) ⇒ Promise

Create a new repo for the authenticated user. See https://developer.github.com/v3/repos/#create

Kind: inner method of src/index

Param Type Description
repo String The repo
description String The repo description
isPrivate String | Boolean Is the repo private

src/index~createOrgRepo(org, repo, description, isPrivate) ⇒ Promise

Create a new repo for a specific org. See https://developer.github.com/v3/repos/#create

Kind: inner method of src/index

Param Type Description
org String The org
repo String The repo
description String The description
isPrivate String | Boolean Is the repo private

src/index~saveDoc(owner, repo, path, content, branch, message, [sha]) ⇒ Promise

Save (i.e. create or update) a document. See https://developer.github.com/v3/repos/contents/#create-or-update-a-file

Kind: inner method of src/index

Param Type Description
owner String The owner
repo String The repo
path String The path
content String The content
branch String The branch
message String The commit message
[sha] String The SHA

src/index~saveAsPullRequest(owner, repo, path, content, branch, message, title, [sha]) ⇒ Promise

Save (i.e. create) a document as a pull request. See https://developer.github.com/v3/pulls/#create-a-pull-request

Kind: inner method of src/index

Param Type Description
owner String The owner
repo String The repo
path String The path
content String The content
branch String The branch
message String The commit message
title String The title of the pull request
[sha] String The SHA

src/index~createFork(owner, repo, [organization]) ⇒ Promise

Create a fork for the authenticated user. See https://octokit.github.io/rest.js/v18#repos-create-fork

Kind: inner method of src/index

Param Type Description
owner String The owner
repo String The repo
[organization] String The organization

src/index~searchCode(query, page, per_page) ⇒ Promise

Search for files based on a specific query. See https://developer.github.com/v3/search/#search-code

Kind: inner method of src/index

Param Type Description
query String The query
page String The page number
per_page String Results per page

src/index~searchRepos(query, page, per_page) ⇒ Promise

Search for repos based on a specific query. See https://developer.github.com/v3/search/#search-repositories

Kind: inner method of src/index

Param Type Description
query String The query
page String The page number
per_page String Results per page

src/index~getRepoContents(owner, repo) ⇒ Promise

Gets the contents (i.e. file structure) of a repo using the GitHub recursive tree method. See https://developer.github.com/v3/git/trees/#get-a-tree-recursively

Kind: inner method of src/index

Param Type Description
owner String The owner
repo String The repo

src/index~getRepoContentsByDrillDown(owner, repo) ⇒ Promise

Gets the contents (i.e. file structure) of a repo by manually recursing. Intended to be used if the github recursive option didn't work because the repository is too big.

Kind: inner method of src/index

Param Type Description
owner String The owner
repo String The repo