Skip to content

repos

Accessed as client.repos; the async client mirrors it.

Repos

The repos namespace.

actions

actions: ReposActions = ReposActions(client)

activities

activities: ReposActivities = ReposActivities(client)

archive

archive: ReposArchive = ReposArchive(client)

avatar

avatar: ReposAvatar = ReposAvatar(client)

branch_protections

branch_protections: ReposBranchProtections = ReposBranchProtections(client)

branches

branches: ReposBranches = ReposBranches(client)

collaborators

collaborators: ReposCollaborators = ReposCollaborators(client)

commits

commits: ReposCommits = ReposCommits(client)

contents

contents: ReposContents = ReposContents(client)

editorconfig

editorconfig: ReposEditorconfig = ReposEditorconfig(client)

flags

flags: ReposFlags = ReposFlags(client)

forks

forks: ReposForks = ReposForks(client)

git

git: ReposGit = ReposGit(client)

hooks

hooks: ReposHooks = ReposHooks(client)

issue_config

issue_config: ReposIssueConfig = ReposIssueConfig(client)

issues

issues: ReposIssues = ReposIssues(client)

keys

keys: ReposKeys = ReposKeys(client)

labels

labels: ReposLabels = ReposLabels(client)

media

media: ReposMedia = ReposMedia(client)

milestones

milestones: ReposMilestones = ReposMilestones(client)

notifications

notifications: ReposNotifications = ReposNotifications(client)

pulls

pulls: ReposPulls = ReposPulls(client)

push_mirrors

push_mirrors: ReposPushMirrors = ReposPushMirrors(client)

raw

raw: ReposRaw = ReposRaw(client)

releases

releases: ReposReleases = ReposReleases(client)

statuses

statuses: ReposStatuses = ReposStatuses(client)

subscription

subscription: ReposSubscription = ReposSubscription(client)

sync_fork

sync_fork: ReposSyncFork = ReposSyncFork(client)

tag_protections

tag_protections: ReposTagProtections = ReposTagProtections(client)

tags

tags: ReposTags = ReposTags(client)

teams

teams: ReposTeams = ReposTeams(client)

times

times: ReposTimes = ReposTimes(client)

topics

topics: ReposTopics = ReposTopics(client)

wiki

wiki: ReposWiki = ReposWiki(client)

accept_transfer

accept_transfer(owner: str, repo: str) -> Repository

Accept a repo transfer.

Parameters:

Name Type Description Default
owner str

owner of the repo to transfer

required
repo str

name of the repo to transfer

required

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
PayloadTooLargeError
  1. QuotaExceeded.

Operation ID: acceptRepoTransfer

apply_diff_patch

apply_diff_patch(
    owner: str,
    repo: str,
    *,
    author: Identity | None = None,
    branch: str | None = None,
    committer: Identity | None = None,
    content: str,
    dates: CommitDateOptions | None = None,
    force_overwrite_new_branch: bool | None = None,
    from_path: str | None = None,
    message: str | None = None,
    new_branch: str | None = None,
    sha: str,
    signoff: bool | None = None,
) -> FileResponse

Apply diff patch to repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
author Identity | None
None
branch str | None

branch (optional) to base this file from. if not given, the default branch is used

None
committer Identity | None
None
content str

content must be base64 encoded

required
dates CommitDateOptions | None
None
force_overwrite_new_branch bool | None

(optional) will do a force-push if the new branch already exists

None
from_path str | None

from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL

None
message str | None

message (optional) for the commit of this file. if not supplied, a default message will be used

None
new_branch str | None

new_branch (optional) will make a new branch from branch before creating the file

None
sha str

sha is the SHA for the file that already exists

required
signoff bool | None

Add a Signed-off-by trailer by the committer at the end of the commit log message.

None

Returns:

Type Description
FileResponse

FileResponse.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.
PayloadTooLargeError
  1. QuotaExceeded.
LockedError
  1. APIRepoArchivedError is an error that is raised when an archived repo should be modified.

Operation ID: repoApplyDiffPatch

assignees

assignees(owner: str, repo: str) -> list[User]

Return all users that have write access and can be assigned to issues.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[User]

UserList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetAssignees

compare

compare(owner: str, repo: str, basehead: str) -> Compare

Get commit comparison information.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
basehead str

compare two branches or commits

required

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoCompareDiff

convert

convert(owner: str, repo: str) -> Repository

Convert a mirror repo to a normal repo.

Parameters:

Name Type Description Default
owner str

owner of the repo to convert

required
repo str

name of the repo to convert

required

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoConvert

delete

delete(owner: str, repo: str) -> None

Delete a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo to delete

required
repo str

name of the repo to delete

required

Returns:

Type Description
None

No content.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoDelete

generate

generate(
    template_owner: str,
    template_repo: str,
    *,
    avatar: bool | None = None,
    default_branch: str | None = None,
    description: str | None = None,
    git_content: bool | None = None,
    git_hooks: bool | None = None,
    labels: bool | None = None,
    name: str,
    owner: str,
    private: bool | None = None,
    protected_branch: bool | None = None,
    topics: bool | None = None,
    webhooks: bool | None = None,
) -> Repository

Create a repository using a template.

Parameters:

Name Type Description Default
template_owner str

name of the template repository owner

required
template_repo str

name of the template repository

required
avatar bool | None

include avatar of the template repo

None
default_branch str | None

Default branch of the new repository

None
description str | None

Description of the repository to create

None
git_content bool | None

include git content of default branch in template repo

None
git_hooks bool | None

include git hooks in template repo

None
labels bool | None

include labels in template repo

None
name str

Name of the repository to create

required
owner str

The organization or person who will own the new repository

required
private bool | None

Whether the repository is private

None
protected_branch bool | None

include protected branches in template repo

None
topics bool | None

include topics in template repo

None
webhooks bool | None

include webhooks in template repo

None

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
ConflictError
  1. The repository with the same name already exists.
PayloadTooLargeError
  1. QuotaExceeded.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: generateRepo

get

get(owner: str, repo: str) -> Repository

Get a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGet

issue_templates

issue_templates(owner: str, repo: str) -> list[IssueTemplate]

Get available issue templates for a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[IssueTemplate]

IssueTemplates.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetIssueTemplates

languages

languages(owner: str, repo: str) -> dict[str, int]

Get languages and number of bytes of code written.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
dict[str, int]

LanguageStatistics.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetLanguages

migrate

migrate(
    *,
    auth_password: str | None = None,
    auth_token: str | None = None,
    auth_username: str | None = None,
    clone_addr: str,
    description: str | None = None,
    issues: bool | None = None,
    labels: bool | None = None,
    lfs: bool | None = None,
    lfs_endpoint: str | None = None,
    milestones: bool | None = None,
    mirror: bool | None = None,
    mirror_interval: str | None = None,
    private: bool | None = None,
    pull_requests: bool | None = None,
    releases: bool | None = None,
    repo_name: str,
    repo_owner: str | None = None,
    service: MigrateRepoOptionsService | None = None,
    uid: int | None = None,
    wiki: bool | None = None,
) -> Repository

Migrate a remote git repository.

Parameters:

Name Type Description Default
auth_password str | None
None
auth_token str | None
None
auth_username str | None
None
clone_addr str
required
description str | None
None
issues bool | None
None
labels bool | None
None
lfs bool | None
None
lfs_endpoint str | None
None
milestones bool | None
None
mirror bool | None
None
mirror_interval str | None
None
private bool | None
None
pull_requests bool | None
None
releases bool | None
None
repo_name str
required
repo_owner str | None

Name of User or Organisation who will own Repo after migration

None
service MigrateRepoOptionsService | None
None
uid int | None

deprecated (only for backwards compatibility)

None
wiki bool | None
None

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
ConflictError
  1. The repository with the same name already exists.
PayloadTooLargeError
  1. QuotaExceeded.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoMigrate

mirror_sync

mirror_sync(owner: str, repo: str) -> None

Sync a mirrored repository.

Parameters:

Name Type Description Default
owner str

owner of the repo to sync

required
repo str

name of the repo to sync

required

Returns:

Type Description
None

No content.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
PayloadTooLargeError
  1. QuotaExceeded.

Operation ID: repoMirrorSync

new_pin_allowed

new_pin_allowed(owner: str, repo: str) -> NewIssuePinsAllowed

Returns if new Issue Pins are allowed.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
NewIssuePinsAllowed

RepoNewIssuePinsAllowed.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoNewPinAllowed

push_mirrors_sync

push_mirrors_sync(owner: str, repo: str) -> None

Sync all push mirrored repository.

Parameters:

Name Type Description Default
owner str

owner of the repo to sync

required
repo str

name of the repo to sync

required

Returns:

Type Description
None

No content.

Raises:

Type Description
BadRequestError
  1. APIError is error format response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
PayloadTooLargeError
  1. QuotaExceeded.

Operation ID: repoPushMirrorSync

reject_transfer

reject_transfer(owner: str, repo: str) -> Repository

Reject a repo transfer.

Parameters:

Name Type Description Default
owner str

owner of the repo to transfer

required
repo str

name of the repo to transfer

required

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: rejectRepoTransfer

reviewers

reviewers(owner: str, repo: str) -> list[User]

Return all users that can be requested to review in this repo.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[User]

UserList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetReviewers

search

search(
    *,
    q: str | None = None,
    topic: bool | None = None,
    include_desc: bool | None = None,
    uid: int | None = None,
    priority_owner_id: int | None = None,
    team_id: int | None = None,
    starred_by: int | None = None,
    private: bool | None = None,
    is_private: bool | None = None,
    template: bool | None = None,
    archived: bool | None = None,
    mode: str | None = None,
    exclusive: bool | None = None,
    sort: Literal["alpha", "created", "updated", "size", "git_size", "lfs_size", "id", "stars", "forks"] | None = None,
    order: Literal["asc", "desc"] | None = None,
    page: int | None = None,
    limit: int | None = None,
) -> SearchResults

Search for repositories.

Parameters:

Name Type Description Default
q str | None

keyword

None
topic bool | None

Limit search to repositories with keyword as topic

None
include_desc bool | None

include search of keyword within repository description

None
uid int | None

search only for repos that the user with the given id owns or contributes to

None
priority_owner_id int | None

repo owner to prioritize in the results

None
team_id int | None

search only for repos that belong to the given team id

None
starred_by int | None

search only for repos that the user with the given id has starred

None
private bool | None

include private repositories this user has access to (defaults to true)

None
is_private bool | None

show only public, private or all repositories (defaults to all)

None
template bool | None

show only template, non-template or all repositories (defaults to all)

None
archived bool | None

show only archived, non-archived or all repositories (defaults to all)

None
mode str | None

type of repository to search for. Supported values are "fork", "source", "mirror" and "collaborative"

None
exclusive bool | None

if uid is given, search only for repos that the user owns

None
sort Literal['alpha', 'created', 'updated', 'size', 'git_size', 'lfs_size', 'id', 'stars', 'forks'] | None

sort repos by attribute. Supported values are "alpha", "created", "updated", "size", "git_size", "lfs_size", "stars", "forks" and "id". Default is "alpha"

None
order Literal['asc', 'desc'] | None

sort order, either "asc" (ascending) or "desc" (descending). Default is "asc", ignored if "sort" is not specified.

None
page int | None

page number of results to return (1-based)

None
limit int | None

page size of results

None

Returns:

Type Description
SearchResults

SearchResults.

Raises:

Type Description
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoSearch

signing_key_gpg

signing_key_gpg(owner: str, repo: str) -> str

Get signing-key.gpg for given repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
str

GPG armored public key.

Operation ID: repoSigningKey

stargazers

stargazers(owner: str, repo: str, *, page: int | None = None, limit: int | None = None) -> Paginated[User]

List a repo's stargazers.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
Paginated[User]

UserList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoListStargazers

subscribers

subscribers(owner: str, repo: str, *, page: int | None = None, limit: int | None = None) -> Paginated[User]

List a repo's watchers.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
Paginated[User]

UserList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoListSubscribers

transfer

transfer(owner: str, repo: str, *, new_owner: str, team_ids: list[int] | None = None) -> Repository

Transfer a repo ownership.

Parameters:

Name Type Description Default
owner str

owner of the repo to transfer

required
repo str

name of the repo to transfer

required
new_owner str
required
team_ids list[int] | None

ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories.

None

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
PayloadTooLargeError
  1. QuotaExceeded.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoTransfer

update

update(
    owner: str,
    repo: str,
    *,
    allow_fast_forward_only_merge: bool | None = None,
    allow_manual_merge: bool | None = None,
    allow_merge_commits: bool | None = None,
    allow_rebase: bool | None = None,
    allow_rebase_explicit: bool | None = None,
    allow_rebase_update: bool | None = None,
    allow_squash_merge: bool | None = None,
    archived: bool | None = None,
    autodetect_manual_merge: bool | None = None,
    default_allow_maintainer_edit: bool | None = None,
    default_branch: str | None = None,
    default_delete_branch_after_merge: bool | None = None,
    default_merge_style: str | None = None,
    default_update_style: str | None = None,
    description: str | None = None,
    enable_prune: bool | None = None,
    external_tracker: ExternalTracker | None = None,
    external_wiki: ExternalWiki | None = None,
    globally_editable_wiki: bool | None = None,
    has_actions: bool | None = None,
    has_issues: bool | None = None,
    has_packages: bool | None = None,
    has_projects: bool | None = None,
    has_pull_requests: bool | None = None,
    has_releases: bool | None = None,
    has_wiki: bool | None = None,
    ignore_whitespace_conflicts: bool | None = None,
    internal_tracker: InternalTracker | None = None,
    mirror_interval: str | None = None,
    name: str | None = None,
    private: bool | None = None,
    template: bool | None = None,
    website: str | None = None,
    wiki_branch: str | None = None,
) -> Repository

Edit a repository's properties. Only fields that are set will be changed.

Parameters:

Name Type Description Default
owner str

owner of the repo to edit

required
repo str

name of the repo to edit

required
allow_fast_forward_only_merge bool | None

either true to allow fast-forward-only merging pull requests, or false to prevent fast-forward-only merging.

None
allow_manual_merge bool | None

either true to allow mark pr as merged manually, or false to prevent it.

None
allow_merge_commits bool | None

either true to allow merging pull requests with a merge commit, or false to prevent merging pull requests with merge commits.

None
allow_rebase bool | None

either true to allow rebase-merging pull requests, or false to prevent rebase-merging.

None
allow_rebase_explicit bool | None

either true to allow rebase with explicit merge commits (--no-ff), or false to prevent rebase with explicit merge commits.

None
allow_rebase_update bool | None

either true to allow updating pull request branch by rebase, or false to prevent it.

None
allow_squash_merge bool | None

either true to allow squash-merging pull requests, or false to prevent squash-merging.

None
archived bool | None

set to true to archive this repository.

None
autodetect_manual_merge bool | None

either true to enable AutodetectManualMerge, or false to prevent it. Note: In some special cases, misjudgments can occur.

None
default_allow_maintainer_edit bool | None

set to true to allow edits from maintainers by default

None
default_branch str | None

sets the default branch for this repository.

None
default_delete_branch_after_merge bool | None

set to true to delete pr branch after merge by default

None
default_merge_style str | None

set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", "squash", "fast-forward-only", "manually-merged", or "rebase-update-only".

None
default_update_style str | None

set to a update style to be used by this repository: "rebase" or "merge"

None
description str | None

a short description of the repository.

None
enable_prune bool | None

enable prune - remove obsolete remote-tracking references when mirroring

None
external_tracker ExternalTracker | None
None
external_wiki ExternalWiki | None
None
globally_editable_wiki bool | None

set the globally editable state of the wiki

None
has_actions bool | None

either true to enable actions unit, or false to disable them.

None
has_issues bool | None

either true to enable issues for this repository or false to disable them.

None
has_packages bool | None

either true to enable packages unit, or false to disable them.

None
has_projects bool | None

either true to enable project unit, or false to disable them.

None
has_pull_requests bool | None

either true to allow pull requests, or false to prevent pull request.

None
has_releases bool | None

either true to enable releases unit, or false to disable them.

None
has_wiki bool | None

either true to enable the wiki for this repository or false to disable it.

None
ignore_whitespace_conflicts bool | None

either true to ignore whitespace for conflicts, or false to not ignore whitespace.

None
internal_tracker InternalTracker | None
None
mirror_interval str | None

set to a string like 8h30m0s to set the mirror interval time

None
name str | None

name of the repository

None
private bool | None

either true to make the repository private or false to make it public. Note: you will get a 422 error if the organization restricts changing repository visibility to organization owners and a non-owner tries to change the value of private.

None
template bool | None

either true to make this repository a template or false to make it a normal repository

None
website str | None

a URL with more information about the repository.

None
wiki_branch str | None

sets the branch used for this repository's wiki.

None

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoEdit

AsyncRepos

The repos namespace.

actions

activities

archive

avatar

branch_protections

branches

collaborators

commits

contents

editorconfig

flags

forks

git

hooks

issue_config

issues

keys

labels

media

milestones

notifications

pulls

push_mirrors

raw

releases

statuses

subscription

sync_fork

tag_protections

tags

teams

times

topics

wiki

accept_transfer

accept_transfer(owner: str, repo: str) -> Repository

Accept a repo transfer.

Parameters:

Name Type Description Default
owner str

owner of the repo to transfer

required
repo str

name of the repo to transfer

required

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
PayloadTooLargeError
  1. QuotaExceeded.

Operation ID: acceptRepoTransfer

apply_diff_patch

apply_diff_patch(
    owner: str,
    repo: str,
    *,
    author: Identity | None = None,
    branch: str | None = None,
    committer: Identity | None = None,
    content: str,
    dates: CommitDateOptions | None = None,
    force_overwrite_new_branch: bool | None = None,
    from_path: str | None = None,
    message: str | None = None,
    new_branch: str | None = None,
    sha: str,
    signoff: bool | None = None,
) -> FileResponse

Apply diff patch to repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
author Identity | None
None
branch str | None

branch (optional) to base this file from. if not given, the default branch is used

None
committer Identity | None
None
content str

content must be base64 encoded

required
dates CommitDateOptions | None
None
force_overwrite_new_branch bool | None

(optional) will do a force-push if the new branch already exists

None
from_path str | None

from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL

None
message str | None

message (optional) for the commit of this file. if not supplied, a default message will be used

None
new_branch str | None

new_branch (optional) will make a new branch from branch before creating the file

None
sha str

sha is the SHA for the file that already exists

required
signoff bool | None

Add a Signed-off-by trailer by the committer at the end of the commit log message.

None

Returns:

Type Description
FileResponse

FileResponse.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.
PayloadTooLargeError
  1. QuotaExceeded.
LockedError
  1. APIRepoArchivedError is an error that is raised when an archived repo should be modified.

Operation ID: repoApplyDiffPatch

assignees

assignees(owner: str, repo: str) -> list[User]

Return all users that have write access and can be assigned to issues.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[User]

UserList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetAssignees

compare

compare(owner: str, repo: str, basehead: str) -> Compare

Get commit comparison information.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
basehead str

compare two branches or commits

required

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoCompareDiff

convert

convert(owner: str, repo: str) -> Repository

Convert a mirror repo to a normal repo.

Parameters:

Name Type Description Default
owner str

owner of the repo to convert

required
repo str

name of the repo to convert

required

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoConvert

delete

delete(owner: str, repo: str) -> None

Delete a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo to delete

required
repo str

name of the repo to delete

required

Returns:

Type Description
None

No content.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoDelete

generate

generate(
    template_owner: str,
    template_repo: str,
    *,
    avatar: bool | None = None,
    default_branch: str | None = None,
    description: str | None = None,
    git_content: bool | None = None,
    git_hooks: bool | None = None,
    labels: bool | None = None,
    name: str,
    owner: str,
    private: bool | None = None,
    protected_branch: bool | None = None,
    topics: bool | None = None,
    webhooks: bool | None = None,
) -> Repository

Create a repository using a template.

Parameters:

Name Type Description Default
template_owner str

name of the template repository owner

required
template_repo str

name of the template repository

required
avatar bool | None

include avatar of the template repo

None
default_branch str | None

Default branch of the new repository

None
description str | None

Description of the repository to create

None
git_content bool | None

include git content of default branch in template repo

None
git_hooks bool | None

include git hooks in template repo

None
labels bool | None

include labels in template repo

None
name str

Name of the repository to create

required
owner str

The organization or person who will own the new repository

required
private bool | None

Whether the repository is private

None
protected_branch bool | None

include protected branches in template repo

None
topics bool | None

include topics in template repo

None
webhooks bool | None

include webhooks in template repo

None

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
ConflictError
  1. The repository with the same name already exists.
PayloadTooLargeError
  1. QuotaExceeded.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: generateRepo

get

get(owner: str, repo: str) -> Repository

Get a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGet

issue_templates

issue_templates(owner: str, repo: str) -> list[IssueTemplate]

Get available issue templates for a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[IssueTemplate]

IssueTemplates.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetIssueTemplates

languages

languages(owner: str, repo: str) -> dict[str, int]

Get languages and number of bytes of code written.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
dict[str, int]

LanguageStatistics.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetLanguages

migrate

migrate(
    *,
    auth_password: str | None = None,
    auth_token: str | None = None,
    auth_username: str | None = None,
    clone_addr: str,
    description: str | None = None,
    issues: bool | None = None,
    labels: bool | None = None,
    lfs: bool | None = None,
    lfs_endpoint: str | None = None,
    milestones: bool | None = None,
    mirror: bool | None = None,
    mirror_interval: str | None = None,
    private: bool | None = None,
    pull_requests: bool | None = None,
    releases: bool | None = None,
    repo_name: str,
    repo_owner: str | None = None,
    service: MigrateRepoOptionsService | None = None,
    uid: int | None = None,
    wiki: bool | None = None,
) -> Repository

Migrate a remote git repository.

Parameters:

Name Type Description Default
auth_password str | None
None
auth_token str | None
None
auth_username str | None
None
clone_addr str
required
description str | None
None
issues bool | None
None
labels bool | None
None
lfs bool | None
None
lfs_endpoint str | None
None
milestones bool | None
None
mirror bool | None
None
mirror_interval str | None
None
private bool | None
None
pull_requests bool | None
None
releases bool | None
None
repo_name str
required
repo_owner str | None

Name of User or Organisation who will own Repo after migration

None
service MigrateRepoOptionsService | None
None
uid int | None

deprecated (only for backwards compatibility)

None
wiki bool | None
None

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
ConflictError
  1. The repository with the same name already exists.
PayloadTooLargeError
  1. QuotaExceeded.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoMigrate

mirror_sync

mirror_sync(owner: str, repo: str) -> None

Sync a mirrored repository.

Parameters:

Name Type Description Default
owner str

owner of the repo to sync

required
repo str

name of the repo to sync

required

Returns:

Type Description
None

No content.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
PayloadTooLargeError
  1. QuotaExceeded.

Operation ID: repoMirrorSync

new_pin_allowed

new_pin_allowed(owner: str, repo: str) -> NewIssuePinsAllowed

Returns if new Issue Pins are allowed.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
NewIssuePinsAllowed

RepoNewIssuePinsAllowed.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoNewPinAllowed

push_mirrors_sync

push_mirrors_sync(owner: str, repo: str) -> None

Sync all push mirrored repository.

Parameters:

Name Type Description Default
owner str

owner of the repo to sync

required
repo str

name of the repo to sync

required

Returns:

Type Description
None

No content.

Raises:

Type Description
BadRequestError
  1. APIError is error format response.
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
PayloadTooLargeError
  1. QuotaExceeded.

Operation ID: repoPushMirrorSync

reject_transfer

reject_transfer(owner: str, repo: str) -> Repository

Reject a repo transfer.

Parameters:

Name Type Description Default
owner str

owner of the repo to transfer

required
repo str

name of the repo to transfer

required

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: rejectRepoTransfer

reviewers

reviewers(owner: str, repo: str) -> list[User]

Return all users that can be requested to review in this repo.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[User]

UserList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetReviewers

search

search(
    *,
    q: str | None = None,
    topic: bool | None = None,
    include_desc: bool | None = None,
    uid: int | None = None,
    priority_owner_id: int | None = None,
    team_id: int | None = None,
    starred_by: int | None = None,
    private: bool | None = None,
    is_private: bool | None = None,
    template: bool | None = None,
    archived: bool | None = None,
    mode: str | None = None,
    exclusive: bool | None = None,
    sort: Literal["alpha", "created", "updated", "size", "git_size", "lfs_size", "id", "stars", "forks"] | None = None,
    order: Literal["asc", "desc"] | None = None,
    page: int | None = None,
    limit: int | None = None,
) -> SearchResults

Search for repositories.

Parameters:

Name Type Description Default
q str | None

keyword

None
topic bool | None

Limit search to repositories with keyword as topic

None
include_desc bool | None

include search of keyword within repository description

None
uid int | None

search only for repos that the user with the given id owns or contributes to

None
priority_owner_id int | None

repo owner to prioritize in the results

None
team_id int | None

search only for repos that belong to the given team id

None
starred_by int | None

search only for repos that the user with the given id has starred

None
private bool | None

include private repositories this user has access to (defaults to true)

None
is_private bool | None

show only public, private or all repositories (defaults to all)

None
template bool | None

show only template, non-template or all repositories (defaults to all)

None
archived bool | None

show only archived, non-archived or all repositories (defaults to all)

None
mode str | None

type of repository to search for. Supported values are "fork", "source", "mirror" and "collaborative"

None
exclusive bool | None

if uid is given, search only for repos that the user owns

None
sort Literal['alpha', 'created', 'updated', 'size', 'git_size', 'lfs_size', 'id', 'stars', 'forks'] | None

sort repos by attribute. Supported values are "alpha", "created", "updated", "size", "git_size", "lfs_size", "stars", "forks" and "id". Default is "alpha"

None
order Literal['asc', 'desc'] | None

sort order, either "asc" (ascending) or "desc" (descending). Default is "asc", ignored if "sort" is not specified.

None
page int | None

page number of results to return (1-based)

None
limit int | None

page size of results

None

Returns:

Type Description
SearchResults

SearchResults.

Raises:

Type Description
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoSearch

signing_key_gpg

signing_key_gpg(owner: str, repo: str) -> str

Get signing-key.gpg for given repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
str

GPG armored public key.

Operation ID: repoSigningKey

stargazers

stargazers(owner: str, repo: str, *, page: int | None = None, limit: int | None = None) -> AsyncPaginated[User]

List a repo's stargazers.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
AsyncPaginated[User]

UserList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoListStargazers

subscribers

subscribers(owner: str, repo: str, *, page: int | None = None, limit: int | None = None) -> AsyncPaginated[User]

List a repo's watchers.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
page int | None

1-based page to start iteration at.

None
limit int | None

Page size; the instance caps it server-side.

None

Returns:

Type Description
AsyncPaginated[User]

UserList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoListSubscribers

transfer

transfer(owner: str, repo: str, *, new_owner: str, team_ids: list[int] | None = None) -> Repository

Transfer a repo ownership.

Parameters:

Name Type Description Default
owner str

owner of the repo to transfer

required
repo str

name of the repo to transfer

required
new_owner str
required
team_ids list[int] | None

ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories.

None

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
PayloadTooLargeError
  1. QuotaExceeded.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoTransfer

update

update(
    owner: str,
    repo: str,
    *,
    allow_fast_forward_only_merge: bool | None = None,
    allow_manual_merge: bool | None = None,
    allow_merge_commits: bool | None = None,
    allow_rebase: bool | None = None,
    allow_rebase_explicit: bool | None = None,
    allow_rebase_update: bool | None = None,
    allow_squash_merge: bool | None = None,
    archived: bool | None = None,
    autodetect_manual_merge: bool | None = None,
    default_allow_maintainer_edit: bool | None = None,
    default_branch: str | None = None,
    default_delete_branch_after_merge: bool | None = None,
    default_merge_style: str | None = None,
    default_update_style: str | None = None,
    description: str | None = None,
    enable_prune: bool | None = None,
    external_tracker: ExternalTracker | None = None,
    external_wiki: ExternalWiki | None = None,
    globally_editable_wiki: bool | None = None,
    has_actions: bool | None = None,
    has_issues: bool | None = None,
    has_packages: bool | None = None,
    has_projects: bool | None = None,
    has_pull_requests: bool | None = None,
    has_releases: bool | None = None,
    has_wiki: bool | None = None,
    ignore_whitespace_conflicts: bool | None = None,
    internal_tracker: InternalTracker | None = None,
    mirror_interval: str | None = None,
    name: str | None = None,
    private: bool | None = None,
    template: bool | None = None,
    website: str | None = None,
    wiki_branch: str | None = None,
) -> Repository

Edit a repository's properties. Only fields that are set will be changed.

Parameters:

Name Type Description Default
owner str

owner of the repo to edit

required
repo str

name of the repo to edit

required
allow_fast_forward_only_merge bool | None

either true to allow fast-forward-only merging pull requests, or false to prevent fast-forward-only merging.

None
allow_manual_merge bool | None

either true to allow mark pr as merged manually, or false to prevent it.

None
allow_merge_commits bool | None

either true to allow merging pull requests with a merge commit, or false to prevent merging pull requests with merge commits.

None
allow_rebase bool | None

either true to allow rebase-merging pull requests, or false to prevent rebase-merging.

None
allow_rebase_explicit bool | None

either true to allow rebase with explicit merge commits (--no-ff), or false to prevent rebase with explicit merge commits.

None
allow_rebase_update bool | None

either true to allow updating pull request branch by rebase, or false to prevent it.

None
allow_squash_merge bool | None

either true to allow squash-merging pull requests, or false to prevent squash-merging.

None
archived bool | None

set to true to archive this repository.

None
autodetect_manual_merge bool | None

either true to enable AutodetectManualMerge, or false to prevent it. Note: In some special cases, misjudgments can occur.

None
default_allow_maintainer_edit bool | None

set to true to allow edits from maintainers by default

None
default_branch str | None

sets the default branch for this repository.

None
default_delete_branch_after_merge bool | None

set to true to delete pr branch after merge by default

None
default_merge_style str | None

set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", "squash", "fast-forward-only", "manually-merged", or "rebase-update-only".

None
default_update_style str | None

set to a update style to be used by this repository: "rebase" or "merge"

None
description str | None

a short description of the repository.

None
enable_prune bool | None

enable prune - remove obsolete remote-tracking references when mirroring

None
external_tracker ExternalTracker | None
None
external_wiki ExternalWiki | None
None
globally_editable_wiki bool | None

set the globally editable state of the wiki

None
has_actions bool | None

either true to enable actions unit, or false to disable them.

None
has_issues bool | None

either true to enable issues for this repository or false to disable them.

None
has_packages bool | None

either true to enable packages unit, or false to disable them.

None
has_projects bool | None

either true to enable project unit, or false to disable them.

None
has_pull_requests bool | None

either true to allow pull requests, or false to prevent pull request.

None
has_releases bool | None

either true to enable releases unit, or false to disable them.

None
has_wiki bool | None

either true to enable the wiki for this repository or false to disable it.

None
ignore_whitespace_conflicts bool | None

either true to ignore whitespace for conflicts, or false to not ignore whitespace.

None
internal_tracker InternalTracker | None
None
mirror_interval str | None

set to a string like 8h30m0s to set the mirror interval time

None
name str | None

name of the repository

None
private bool | None

either true to make the repository private or false to make it public. Note: you will get a 422 error if the organization restricts changing repository visibility to organization owners and a non-owner tries to change the value of private.

None
template bool | None

either true to make this repository a template or false to make it a normal repository

None
website str | None

a URL with more information about the repository.

None
wiki_branch str | None

sets the branch used for this repository's wiki.

None

Returns:

Type Description
Repository

Repository.

Raises:

Type Description
ForbiddenError
  1. APIForbiddenError is a forbidden error response.
NotFoundError
  1. APINotFound is a not found error response.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoEdit