Skip to content

collaborators

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

ReposCollaborators

The repos.collaborators namespace.

add

add(owner: str, repo: str, collaborator: str, *, permission: AddCollaboratorOptionPermission | None = None) -> None

Add a collaborator to a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
collaborator str

username of the collaborator to add

required
permission AddCollaboratorOptionPermission | None
None

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.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoAddCollaborator

get

get(owner: str, repo: str, collaborator: str) -> None

Check if a user is a collaborator of a repository.

If the user is a collaborator, return 204. If the user is not a collaborator, return 404.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
collaborator str

username of the collaborator

required

Returns:

Type Description
None

No content.

Raises:

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

Operation ID: repoCheckCollaborator

list

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

List a repository's collaborators.

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: repoListCollaborators

permission

permission(owner: str, repo: str, collaborator: str) -> RepoCollaboratorPermission

Get repository permissions for a user.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
collaborator str

username of the collaborator

required

Returns:

Type Description
RepoCollaboratorPermission

RepoCollaboratorPermission.

Raises:

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

Operation ID: repoGetRepoPermissions

remove

remove(owner: str, repo: str, collaborator: str) -> None

Delete a collaborator from a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
collaborator str

username of the collaborator to delete

required

Returns:

Type Description
None

No content.

Raises:

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

Operation ID: repoDeleteCollaborator

AsyncReposCollaborators

The repos.collaborators namespace.

add

add(owner: str, repo: str, collaborator: str, *, permission: AddCollaboratorOptionPermission | None = None) -> None

Add a collaborator to a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
collaborator str

username of the collaborator to add

required
permission AddCollaboratorOptionPermission | None
None

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.
UnprocessableEntityError
  1. APIValidationError is error format response related to input validation.

Operation ID: repoAddCollaborator

get

get(owner: str, repo: str, collaborator: str) -> None

Check if a user is a collaborator of a repository.

If the user is a collaborator, return 204. If the user is not a collaborator, return 404.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
collaborator str

username of the collaborator

required

Returns:

Type Description
None

No content.

Raises:

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

Operation ID: repoCheckCollaborator

list

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

List a repository's collaborators.

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: repoListCollaborators

permission

permission(owner: str, repo: str, collaborator: str) -> RepoCollaboratorPermission

Get repository permissions for a user.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
collaborator str

username of the collaborator

required

Returns:

Type Description
RepoCollaboratorPermission

RepoCollaboratorPermission.

Raises:

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

Operation ID: repoGetRepoPermissions

remove

remove(owner: str, repo: str, collaborator: str) -> None

Delete a collaborator from a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
collaborator str

username of the collaborator to delete

required

Returns:

Type Description
None

No content.

Raises:

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

Operation ID: repoDeleteCollaborator