Skip to content
Anton edited this page Dec 1, 2019 · 2 revisions

These methods allow to work with repositories.

async create(
  options: CreateRepository,
): Repository

Create a new repository.

CreateRepository: Options to create a repository.

Name Type Description Default
org string The organisation on which to create the repository (if not adding to the user account). -
name* string The name of the repository. -
description string A short description of the repository. -
homepage string A URL with more information about the repository. -
license_template string Choose an open source license template that best suits your needs, and then use the license keyword as the license_template string. For example, "mit" or "mpl-2.0". -
gitignore_template string Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell". -
auto_init boolean Pass true to create an initial commit with empty README. false
Repository
Name Type Description
id* number 1296269
node_id* string MDEwOlJlcG9zaXRvcnkxMjk2MjY5
name* string Hello-World
full_name* string octocat/Hello-World
private* boolean false
html_url* string https://github.com/octocat/Hello-World
description* string This your first repo!
fork* boolean true
url* string https://api.github.com/repos/octocat/Hello-World
archive_url* string http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}
assignees_url* string http://api.github.com/repos/octocat/Hello-World/assignees{/user}
blobs_url* string http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}
branches_url* string http://api.github.com/repos/octocat/Hello-World/branches{/branch}
collaborators_url* string http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}
comments_url* string http://api.github.com/repos/octocat/Hello-World/comments{/number}
commits_url* string http://api.github.com/repos/octocat/Hello-World/commits{/sha}
compare_url* string http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}
contents_url* string http://api.github.com/repos/octocat/Hello-World/contents/{+path}
contributors_url* string http://api.github.com/repos/octocat/Hello-World/contributors
deployments_url* string http://api.github.com/repos/octocat/Hello-World/deployments
downloads_url* string http://api.github.com/repos/octocat/Hello-World/downloads
events_url* string http://api.github.com/repos/octocat/Hello-World/events
forks_url* string http://api.github.com/repos/octocat/Hello-World/forks
git_commits_url* string http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}
git_refs_url* string http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}
git_tags_url* string http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}
git_url* string git:github.com/octocat/Hello-World.git
issue_comment_url* string http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}
issue_events_url* string http://api.github.com/repos/octocat/Hello-World/issues/events{/number}
issues_url* string http://api.github.com/repos/octocat/Hello-World/issues{/number}
keys_url* string http://api.github.com/repos/octocat/Hello-World/keys{/key_id}
labels_url* string http://api.github.com/repos/octocat/Hello-World/labels{/name}
languages_url* string http://api.github.com/repos/octocat/Hello-World/languages
merges_url* string http://api.github.com/repos/octocat/Hello-World/merges
milestones_url* string http://api.github.com/repos/octocat/Hello-World/milestones{/number}
notifications_url* string http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}
pulls_url* string http://api.github.com/repos/octocat/Hello-World/pulls{/number}
releases_url* string http://api.github.com/repos/octocat/Hello-World/releases{/id}
ssh_url* string git@github.com:octocat/Hello-World.git
stargazers_url* string http://api.github.com/repos/octocat/Hello-World/stargazers
statuses_url* string http://api.github.com/repos/octocat/Hello-World/statuses/{sha}
subscribers_url* string http://api.github.com/repos/octocat/Hello-World/subscribers
subscription_url* string http://api.github.com/repos/octocat/Hello-World/subscription
tags_url* string http://api.github.com/repos/octocat/Hello-World/tags
teams_url* string http://api.github.com/repos/octocat/Hello-World/teams
trees_url* string http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}
clone_url* string https://github.com/octocat/Hello-World.git
mirror_url* string git:git.example.com/octocat/Hello-World
hooks_url* string http://api.github.com/repos/octocat/Hello-World/hooks
svn_url* string https://svn.github.com/octocat/Hello-World
homepage* string https://github.com
forks_count* number 9
stargazers_count* number 80
watchers_count* number 80
size* number 108
default_branch* string master
open_issues_count* number 0
has_issues* boolean true
has_projects* boolean true
has_wiki* boolean true
has_pages* boolean false
has_downloads* boolean true
archived* boolean false
pushed_at* string 2011-01-26T19:06:43Z
created_at* string 2011-01-26T19:01:12Z
updated_at* string 2011-01-26T19:14:43Z
allow_rebase_merge* boolean true
allow_squash_merge* boolean true
allow_merge_commit* boolean true
subscribers_count* number 42
network_count* number 0
topics* string[] ["octocat", "atom", "electron", "API"]
permissions* { admin: boolean, push: boolean, pull: boolean }
language* string
owner* Owner
Owner
Name Type Description
login* string octocat
id* number 1
node_id* string MDQ6VXNlcjE=
avatar_url* string https://github.com/images/error/octocat_happy.gif
gravatar_id* string
url* string https://api.github.com/users/octocat
html_url* string https://github.com/octocat
followers_url* string https://api.github.com/users/octocat/followers
following_url* string https://api.github.com/users/octocat/following{/other_user}
gists_url* string https://api.github.com/users/octocat/gists{/gist_id}
starred_url* string https://api.github.com/users/octocat/starred{/owner}{/repo}
subscriptions_url* string https://api.github.com/users/octocat/subscriptions
organizations_url* string https://api.github.com/users/octocat/orgs
repos_url* string https://api.github.com/users/octocat/repos
events_url* string https://api.github.com/users/octocat/events{/privacy}
received_events_url* string https://api.github.com/users/octocat/received_events
type* string User
site_admin* boolean false

async delete(
  owner: string,
  name: string,
): void

Delete a repository.

async edit(
  options: Edit,
): void

Makes changes to the repository.

RepoEdit: Options to edit a repository.

Name Type Description Default
name string The name of the repository. -
description string A short description of the repository. -
homepage string A URL with more information about the repository. -
private boolean Either true to make the repository private or false to make it public. Creating private repositories requires a paid GitHub account. false
has_issues boolean Either true to enable issues for this repository or false to disable them. true
has_projects boolean Either true to enable projects for this repository or false to disable them. true
has_wiki boolean Either true to enable the wiki for this repository or false to disable it. true
is_template boolean Either true to make this repo available as a template repository or false to prevent it. false
default_branch string Updates the default branch for this repository. -
allow_squash_merge boolean Either true to allow squash-merging pull requests, or false to prevent squash-merging. true
allow_merge_commit boolean Either true to allow merging pull requests with a merge commit, or false to prevent merging pull requests with merge commits. true
allow_rebase_merge boolean Either true to allow rebase-merging pull requests, or false to prevent rebase-merging. true
archived boolean true to archive this repository. Note: You cannot unarchive repositories through the API. false

async generate(
  string: templateOwner,
  string: templateName,
  options: Generate,
): Repository

Generates a new repository from the template.

Generate: Options to generate a repository from a template.

Name Type Description
owner string The organisation on which to create the repository (if not adding to the user account).
name* string The name of the repository.
description string A short description of the repository.
private boolean Whether it is a private repository.