gitcode_api.resources.collaboration

Classes for resource groups: issues, labels, members, milestones, and pull requests.

class AsyncIssuesResource(client: AsyncAPIClient)

Bases: AsyncResource, AbstractIssuesResource

Asynchronous issue endpoints.

Methods correspond one-to-one with IssuesResource; signatures, JSON/query payloads, and return types are the same. Refer to the synchronous class for full parameter descriptions aligned with docs/rest_api (Issues API).

Bind the resource to an asynchronous API client.

async list(*, owner: str | None = None, repo: str | None = None, state: str | None = None, sort: str | None = None, direction: str | None = None, page: int | None = None, per_page: int | None = None) List[Issue]

List issues for a repository.

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository name. Uses the client default when omitted.

  • state – Issue state filter such as open or closed (see Issues API).

  • sort – Optional sort field.

  • direction – Optional sort direction.

  • page – Page number.

  • per_page – Page size.

Returns:

Matching issues.

async get(*, number: int | str, owner: str | None = None, repo: str | None = None) Issue

Get a single issue by number.

Parameters:
  • number – Repository-local issue number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository name. Uses the client default when omitted.

Returns:

Issue details.

async create(*, owner: str, repo: str | None = None, title: str, body: str | None = None, assignee: str | None = None, labels: List[str] | None = None, milestone: int | str | None = None, security_hole: str | None = None) Issue

Create an issue for a repository.

Parameters:
  • owner – Repository owner path.

  • repo – Repository name. Uses the client default when omitted.

  • title – Issue title.

  • body – Optional issue description.

  • assignee – Optional assignee username.

  • labels – Optional label names.

  • milestone – Optional milestone identifier.

  • security_hole – Whether the issue is private; form field described in the Issues API (default public).

Returns:

Created issue details.

async update(*, number: int | str, owner: str, repo: str | None = None, title: str | None = None, body: str | None = None, state: str | None = None, assignee: str | None = None, labels: List[str] | None = None, milestone: int | str | None = None, security_hole: str | None = None) Issue

Update an existing issue.

Parameters:
  • number – Repository-local issue number.

  • owner – Repository owner path.

  • repo – Repository name. Uses the client default when omitted.

  • title – Updated issue title.

  • body – Updated issue description.

  • state – Updated state such as reopen or close.

  • assignee – Updated assignee username.

  • labels – Replacement label names.

  • milestone – Updated milestone identifier.

  • security_hole – Whether the issue is private; form field described in the Issues API.

Returns:

Updated issue details.

async list_comments(*, number: int | str, owner: str | None = None, repo: str | None = None, page: int | None = None, per_page: int | None = None) List[IssueComment]

List comments for an issue.

Parameters:
  • number – Repository-local issue number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path (name). Uses the client default when omitted.

  • page – Current page number (query).

  • per_page – Page size; maximum per REST API is typically 100.

Returns:

Issue comments.

async create_comment(*, number: int | str, body: str, owner: str | None = None, repo: str | None = None) IssueComment

Create a comment on an issue.

Parameters:
  • number – Repository-local issue number.

  • body – Comment body text.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Created comment.

async get_comment(*, comment_id: int | str, owner: str | None = None, repo: str | None = None) IssueComment

Get a single issue comment by identifier.

Parameters:
  • comment_id – Comment id from the API.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Issue comment.

async update_comment(*, comment_id: int | str, body: str, owner: str | None = None, repo: str | None = None) IssueComment

Update an issue comment.

Parameters:
  • comment_id – Comment id from the API.

  • body – Updated comment body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Updated comment.

async delete_comment(*, comment_id: int | str, owner: str | None = None, repo: str | None = None) None

Delete an issue comment.

Parameters:
  • comment_id – Comment id from the API.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

async list_pull_requests(*, number: int | str, owner: str | None = None, repo: str | None = None) List[PullRequest]

List pull requests associated with an issue.

Parameters:
  • number – Repository-local issue number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Pull requests linked to the issue.

async add_labels(*, number: int | str, labels: List[str], owner: str | None = None, repo: str | None = None) List[Label]

Add labels to an issue.

Parameters:
  • number – Repository-local issue number.

  • labels – Label names to add (request body is a JSON array per REST API).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Labels on the issue after the operation.

async remove_label(*, number: int | str, name: str, owner: str | None = None, repo: str | None = None) None

Remove one label from an issue (REST path includes the label name).

Parameters:
  • number – Repository-local issue number.

  • name – Label name to remove.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

async list_enterprise(*, enterprise: str, **params) List[Issue]

List enterprise issues visible to the caller.

Parameters:
  • enterprise – Enterprise path or login.

  • params – Additional query parameters accepted by GET .../enterprises/{enterprise}/issues.

Returns:

Enterprise-scoped issues.

async list_user(**params) List[Issue]

List issues for the authenticated user.

Parameters:

params – Query parameters for GET /user/issues (filters, pagination, etc.).

Returns:

Issues assigned to or authored by the user, per API rules.

async list_org(*, org: str, **params) List[Issue]

List organization issues visible to the current user.

Parameters:
  • org – Organization path or login.

  • params – Query parameters for GET .../orgs/{org}/issues.

Returns:

Organization-scoped issues.

async get_enterprise_issue(*, enterprise: str, number: int | str) Issue

Get a specific enterprise issue.

Parameters:
  • enterprise – Enterprise path or login.

  • number – Enterprise issue id or number as accepted by the API path.

Returns:

Issue payload.

async list_enterprise_comments(*, enterprise: str, number: int | str, **params) List[IssueComment]

List comments for an enterprise issue.

Parameters:
  • enterprise – Enterprise path or login.

  • number – Enterprise issue identifier in the path.

  • params – Optional pagination or filter query parameters.

Returns:

Comments on the enterprise issue.

async list_enterprise_labels(*, enterprise: str, issue_id: int | str) List[Label]

List labels attached to an enterprise issue.

Parameters:
  • enterprise – Enterprise path or login.

  • issue_id – Enterprise issue id in the path segment .../issues/{issue_id}/labels.

Returns:

Labels on the issue.

async list_operation_logs(*, owner: str, number: int | str, page: int | None = None, per_page: int | None = None) List[IssueOperationLog]

List operation (audit) logs for an issue.

Parameters:
  • owner – Repository owner path (path segment repos/{owner}/... for this endpoint).

  • number – Repository-local issue number.

  • page – Page number.

  • per_page – Page size.

Returns:

Operation log entries.

async list_templates(*, owner: str | None = None, repo: str | None = None) List[RepositoryGitCodeTemplate]

List active issue templates under .gitcode/ for this repository.

Matches Markdown (.md, .markdown) and YAML (.yml / .yaml) paths whose names start with ISSUE_TEMPLATE under .gitcode/ (case-insensitive), including files inside localized directories such as .gitcode/ISSUE_TEMPLATE.en/.

Resolution tries the repository, then the owner’s .gitcode repository, then any parent main and parent/.gitcode pairs discovered from forks (each candidate is inspected with GET /repos/{owner}/{repo}; when fork is true, its parent’s repos are appended, deduplicated, and visited in order). The first source with matching templates wins.

Version 1.2.19: Now also supporting GitHub-mirrored repos with a .github/ folder.

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository name. Uses the client default when omitted.

Returns:

Template metadata entries (paths and SHAs); empty when none match.

async get_template(*, path: str, owner: str | None = None, repo: str | None = None, encoding: str = 'utf-8', **decoding_kwargs) str

Load a single issue template file body from the default branch.

Uses the same resolution order as list_templates(). The path must match the active issue template naming convention (see GitCode .gitcode documentation).

Parameters:
  • path – Repository-relative path such as .gitcode/ISSUE_TEMPLATE_bug.md or .gitcode/ISSUE_TEMPLATE/config.yml.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository name. Uses the client default when omitted.

  • encoding – Codec to use when decoding raw file bytes. Default utf-8.

  • decoding_kwargs – Keyword arguments forwarded to bytes.decode(), such as errors ("strict", "ignore", or "replace").

Returns:

Decoded template file contents.

class AsyncLabelsResource(client: AsyncAPIClient)

Bases: AsyncResource, AbstractLabelsResource

Asynchronous label endpoints.

Mirrors LabelsResource; see that class for parameter documentation.

Bind the resource to an asynchronous API client.

async list(*, owner: str | None = None, repo: str | None = None) List[Label]

List repository labels.

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

All labels defined on the repository.

async create(*, name: str, color: str, owner: str | None = None, repo: str | None = None) Label

Create a repository label.

Parameters:
  • name – Label name.

  • color – Label color (typically a #RRGGBB hex string per API examples).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Created label.

async update(*, original_name: str, owner: str | None = None, repo: str | None = None, name: str | None = None, color: str | None = None) Label

Update a repository label.

Parameters:
  • original_name – Current label name in the URL path.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • name – New label name, if renaming.

  • color – New color value.

Returns:

Updated label.

async delete(*, name: str, owner: str | None = None, repo: str | None = None) None

Delete a repository label.

Parameters:
  • name – Label name in the path.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

async clear_issue_labels(*, number: int | str, owner: str | None = None, repo: str | None = None) None

Remove all labels from an issue.

Parameters:
  • number – Repository-local issue number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

async replace_issue_labels(*, number: int | str, labels: List[str], owner: str | None = None, repo: str | None = None) List[Label]

Replace all labels on an issue.

Parameters:
  • number – Repository-local issue number.

  • labels – Complete new label set (JSON array body).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Labels after replacement.

async list_enterprise(*, enterprise: str, search: str | None = None, direction: str | None = None, page: int | None = None, per_page: int | None = None, api_version: str = 'v5') List[Label]

List labels for an enterprise, optionally using a different API version.

Parameters:
  • enterprise – Enterprise path or login.

  • search – Optional name search string.

  • direction – Sort direction for results.

  • page – Page number.

  • per_page – Page size.

  • api_versionv5 uses /api/v5/...; other values build /api/{version}/... on the same host.

Returns:

Enterprise label definitions.

class AsyncMembersResource(client: AsyncAPIClient)

Bases: AsyncResource, AbstractMembersResource

Asynchronous repository member endpoints.

Mirrors MembersResource (collaborators API); see that class for parameters.

Bind the resource to an asynchronous API client.

async add_or_update(*, username: str, owner: str | None = None, repo: str | None = None, permission: str | None = None) RepoMember

Add or update repository member permissions.

Parameters:
  • username – Collaborator login.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • permission – Permission string (for example pull, push, admin per GitCode API).

Returns:

Collaborator record.

async remove(*, username: str, owner: str | None = None, repo: str | None = None) None

Remove a repository member.

Parameters:
  • username – Collaborator login to remove.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

async list(*, owner: str | None = None, repo: str | None = None, page: int | None = None, per_page: int | None = None) List[RepoCollaborator]

List repository members (collaborators).

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • page – Page number.

  • per_page – Page size.

Returns:

Collaborators with permission metadata.

async get(*, username: str, owner: str | None = None, repo: str | None = None) RepositoryCollaboratorCheck

Check whether a user is a repository member.

async get_permission(*, username: str, owner: str | None = None, repo: str | None = None) RepoMemberPermission

Get repository member permissions.

Parameters:
  • username – Collaborator login.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Effective permission for the user on the repository.

class AsyncMilestonesResource(client: AsyncAPIClient)

Bases: AsyncResource, AbstractMilestonesResource

Asynchronous milestone endpoints.

Mirrors MilestonesResource; see that class for parameter documentation.

Bind the resource to an asynchronous API client.

async list(*, owner: str | None = None, repo: str | None = None, **params) List[Milestone]

List milestones for a repository.

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • params – Query parameters accepted by the milestones listing (state, sort, pagination, etc.).

Returns:

Milestones.

async get(*, number: int | str, owner: str | None = None, repo: str | None = None) Milestone

Get a single milestone.

Parameters:
  • number – Milestone number in the repository.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Milestone details.

async create(*, title: str, due_on: str, owner: str | None = None, repo: str | None = None, description: str | None = None) Milestone

Create a milestone.

Parameters:
  • title – Milestone title.

  • due_on – Due date string in the format expected by the API (often ISO 8601).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • description – Optional description.

Returns:

Created milestone.

async update(*, number: int | str, title: str, due_on: str, owner: str | None = None, repo: str | None = None, description: str | None = None, state: str | None = None) Milestone

Update a milestone.

Parameters:
  • number – Milestone number.

  • title – Updated title.

  • due_on – Updated due date.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • description – Updated description.

  • state – Milestone state such as open or closed per API.

Returns:

Updated milestone.

async delete(*, number: int | str, owner: str | None = None, repo: str | None = None) None

Delete a milestone.

Parameters:
  • number – Milestone number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

class AsyncPullsResource(client: AsyncAPIClient)

Bases: AsyncResource, AbstractPullsResource

Asynchronous pull request endpoints.

Methods correspond to PullsResource with identical arguments and semantics, including only_count responses documented in the Pull Request API under docs/rest_api.

Bind the resource to an asynchronous API client.

async list(*, owner: str | None = None, repo: str | None = None, state: str | None = None, sort: str | None = None, direction: str | None = None, page: int | None = None, per_page: int | None = None, **params) List[PullRequest] | PullRequestCount

List pull requests for a repository.

When only_count is true in params (or passed via **params), the API returns a JSON object with counts per state instead of an array (see Pull Request API).

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path (name). Uses the client default when omitted.

  • state – PR state filter: all, open, closed, locked, merged (default all in API).

  • sort – Sort field, typically created or updated.

  • directionasc or desc (API default is usually desc).

  • page – Current page number.

  • per_page – Page size (max 100 per API documentation).

  • params – Extra query parameters from the Pull Request API, for example base, since, author, assignee, reviewer, milestone_number, labels (comma-separated), merged_after, merged_before, created_after, created_before, updated_after, updated_before, only_count (boolean), and ISO 8601 timestamps (URL-encoded when sent).

Returns:

A list of pull requests, or an APIObject for count-only responses.

async get(*, number: int | str, owner: str | None = None, repo: str | None = None) PullRequest

Get a single pull request.

Parameters:
  • number – Pull request number in the repository.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Pull request details.

async create(*, title: str, head: str, base: str, owner: str | None = None, repo: str | None = None, body: str | None = None, draft: bool | None = None, assignees: List[str] | None = None, testers: List[str] | None = None, labels: List[str] | None = None, milestone_number: int | None = None, issue: str | None = None, prune_source_branch: bool | None = None, squash: bool | None = None, squash_commit_message: str | None = None, fork_path: str | None = None) PullRequest

Create a pull request.

Parameters:
  • title – Pull request title.

  • head – Source branch ref (head branch, in forks use owner:branch like “SushiNinja:develop”).

  • base – Target branch ref (base branch).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • body – Description body.

  • draft – Whether to create as draft.

  • assignees – Assignee logins; sent as a comma-separated string per API.

  • testers – Tester logins; comma-separated in the JSON body.

  • labels – Label names; comma-separated in the JSON body.

  • milestone_number – Target milestone number.

  • issue – Related issue reference when supported by the API.

  • prune_source_branch – Whether to delete the source branch after merge when applicable.

  • squash – Squash-merge preference where supported.

  • squash_commit_message – Custom squash commit message.

  • fork_path – Fork owner/repo when opening a PR from a fork, like “SushiNinja/agent-core-contrib”.

Returns:

Created pull request.

async update(*, number: int | str, owner: str | None = None, repo: str | None = None, title: str | None = None, body: str | None = None, state: str | None = None, base: str | None = None, labels: List[str] | None = None, draft: bool | None = None) PullRequest

Update a pull request.

Parameters:
  • number – Pull request number in the repository.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • title – New title.

  • body – New description.

  • state – New state as accepted by the API (for example close or reopen semantics).

  • base – New base branch name.

  • labels – Replacement labels; comma-separated in the JSON body.

  • draft – Draft flag.

Returns:

Updated pull request.

async merge(*, number: int | str, owner: str | None = None, repo: str | None = None, merge_commit_message: str | None = None, squash: bool | None = None) MergeResult

Merge a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • merge_commit_message – Optional merge commit message.

  • squash – Whether to squash merge when supported.

Returns:

Merge result payload.

async get_merge_status(*, number: int | str, owner: str | None = None, repo: str | None = None) MergeStatus

Get mergeability status for a pull request (GET on the merge resource).

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Merge status / mergeability information.

async list_commits(*, number: int | str, owner: str | None = None, repo: str | None = None) List[APIObject]

List commits included in a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Commit objects (wrapped as APIObject).

async list_files(*, number: int | str, owner: str | None = None, repo: str | None = None) List[PullRequestFile]

List files changed by a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

File change entries.

async list_comments(*, number: int | str, owner: str | None = None, repo: str | None = None, page: int | None = None, per_page: int | None = None) List[PullRequestComment]

List comments on a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • page – Page number.

  • per_page – Page size.

Returns:

Pull request review comments.

async create_comment(*, number: int | str, body: str, owner: str | None = None, repo: str | None = None, commit_id: str | None = None, path: str | None = None, position: int | None = None) PullRequestComment

Create a pull request (review) comment.

Parameters:
  • number – Pull request number.

  • body – Comment body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • commit_id – Commit SHA the comment applies to.

  • path – File path in the diff.

  • position – Line or diff position as defined by the API.

Returns:

Created comment.

async get_comment(*, comment_id: int | str, owner: str | None = None, repo: str | None = None) PullRequestComment

Get a single pull request comment by id (global comment endpoint).

Parameters:
  • comment_id – Comment id.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Pull request comment.

async update_comment(*, comment_id: int | str, body: str, owner: str | None = None, repo: str | None = None) PullRequestComment

Update a pull request comment.

Parameters:
  • comment_id – Comment id.

  • body – Updated body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Updated comment.

async delete_comment(*, comment_id: int | str, owner: str | None = None, repo: str | None = None) None

Delete a pull request comment.

Parameters:
  • comment_id – Comment id.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

async list_labels(*, number: int | str, owner: str | None = None, repo: str | None = None) List[Label]

List labels attached to a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Labels on the pull request.

async add_labels(*, number: int | str, labels: List[str], owner: str | None = None, repo: str | None = None) List[Label]

Add labels to a pull request.

Parameters:
  • number – Pull request number.

  • labels – Label names (JSON array body per API).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Labels after the operation.

async replace_labels(*, number: int | str, labels: List[str], owner: str | None = None, repo: str | None = None) List[Label]

Replace all labels on a pull request.

Parameters:
  • number – Pull request number.

  • labels – Complete new label set (JSON array body).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Labels after replacement.

async remove_label(*, number: int | str, label: str, owner: str | None = None, repo: str | None = None) None

Remove a label from a pull request.

Parameters:
  • number – Pull request number.

  • label – Label name to remove.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

async request_review(*, number: int | str, owner: str | None = None, repo: str | None = None, event: str, body: str | None = None) None

Submit a pull request review event (approve, request changes, etc., per API).

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • event – Review event name as required by GitCode (for example APPROVE; see API docs).

  • body – Optional comment body accompanying the event.

Returns:

Review result object.

async list_operation_logs(*, number: int | str, owner: str | None = None, repo: str | None = None, **params) List[PullRequestOperationLog]

List operation logs for a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • params – Additional query parameters accepted by the operate_logs endpoint.

Returns:

Log entries as generic API objects.

async request_test(*, number: int | str, owner: str | None = None, repo: str | None = None, **payload) None

Request testing for a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • payload – JSON fields required by the test request endpoint.

Returns:

Test request result.

async update_testers(*, number: int | str, testers: List[str], owner: str | None = None, repo: str | None = None) None

Replace pull request testers.

Parameters:
  • number – Pull request number.

  • testers – New tester list; serialized as a comma-separated testers field in JSON.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

API response payload.

async add_testers(*, number: int | str, testers: List[str], owner: str | None = None, repo: str | None = None) List[UserSummary]

Add testers to a pull request.

Parameters:
  • number – Pull request number.

  • testers – Usernames to add; comma-separated in the JSON body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

API response payload.

async update_assignees(*, number: int | str, assignees: List[str], owner: str | None = None, repo: str | None = None) None

Replace pull request assignees.

Parameters:
  • number – Pull request number.

  • assignees – New assignee list; comma-separated in the JSON body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

API response payload.

async add_assignees(*, number: int | str, assignees: List[str], owner: str | None = None, repo: str | None = None) PullRequestAssigneeCount

Add assignees to a pull request.

Parameters:
  • number – Pull request number.

  • assignees – Usernames to add; comma-separated in the JSON body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

API response payload.

async remove_assignees(*, number: int | str, assignees: List[str], owner: str | None = None, repo: str | None = None) None

Remove assignees from a pull request.

Parameters:
  • number – Pull request number.

  • assignees – Usernames to remove; comma-separated in the JSON body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

async list_issues(*, number: int | str, owner: str | None = None, repo: str | None = None) List[Issue]

List issues linked to a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Linked issues.

async list_enterprise(*, enterprise: str, **params) List[PullRequest]

List enterprise pull requests.

Parameters:
  • enterprise – Enterprise path or login.

  • params – Query parameters for the enterprise pull_requests listing.

Returns:

Pull requests in the enterprise scope.

async list_org(*, org: str, **params) List[PullRequest]

List pull requests for an organization scope.

Parameters:
  • org – Organization path (GET .../org/{org}/pull_requests).

  • params – Query parameters accepted by that listing.

Returns:

Organization-scoped pull requests.

async list_issue_pull_requests(*, enterprise: str, number: int | str) List[PullRequest]

List pull requests associated with an enterprise issue.

Parameters:
  • enterprise – Enterprise path or login.

  • number – Enterprise issue number or id in the path.

Returns:

Related pull requests.

async list_templates(*, owner: str | None = None, repo: str | None = None) List[RepositoryGitCodeTemplate]

List active pull request templates under .gitcode/ for this repository.

Resolution tries the repository, then the owner’s .gitcode repository, then any parent main and parent/.gitcode pairs discovered from forks (each candidate is inspected with GET /repos/{owner}/{repo}; when fork is true, its parent’s repos are appended, deduplicated, and visited in order). The first source with matching templates wins.

Version 1.2.19: Now also supporting GitHub-mirrored repos with a .github/ folder.

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Template metadata entries (paths and SHAs); empty when none match.

async get_template(*, path: str, owner: str | None = None, repo: str | None = None, encoding: str = 'utf-8', **decoding_kwargs) str

Load a single pull request template file body from the default branch.

Uses the same resolution order as list_templates(). The path must match the active pull request template naming convention (see GitCode .gitcode documentation).

Parameters:
  • path – Repository-relative path such as .gitcode/PULL_REQUEST_TEMPLATE.md.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • encoding – Codec to use when decoding raw file bytes. Default utf-8.

  • decoding_kwargs – Keyword arguments forwarded to bytes.decode(), such as errors ("strict", "ignore", or "replace").

Returns:

Decoded template file contents.

class IssuesResource(client: SyncAPIClient)

Bases: SyncResource, AbstractIssuesResource

Synchronous issue endpoints.

Bind the resource to a synchronous API client.

list(*, owner: str | None = None, repo: str | None = None, state: str | None = None, sort: str | None = None, direction: str | None = None, page: int | None = None, per_page: int | None = None) List[Issue]

List issues for a repository.

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository name. Uses the client default when omitted.

  • state – Issue state filter such as open or closed (see Issues API).

  • sort – Optional sort field.

  • direction – Optional sort direction.

  • page – Page number.

  • per_page – Page size.

Returns:

Matching issues.

get(*, number: int | str, owner: str | None = None, repo: str | None = None) Issue

Get a single issue by number.

Parameters:
  • number – Repository-local issue number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository name. Uses the client default when omitted.

Returns:

Issue details.

create(*, owner: str, repo: str | None = None, title: str, body: str | None = None, assignee: str | None = None, labels: List[str] | None = None, milestone: int | str | None = None, security_hole: str | None = None) Issue

Create an issue for a repository.

Parameters:
  • owner – Repository owner path.

  • repo – Repository name. Uses the client default when omitted.

  • title – Issue title.

  • body – Optional issue description.

  • assignee – Optional assignee username.

  • labels – Optional label names.

  • milestone – Optional milestone identifier.

  • security_hole – Whether the issue is private; form field described in the Issues API (default public).

Returns:

Created issue details.

update(*, number: int | str, owner: str, repo: str | None = None, title: str | None = None, body: str | None = None, state: str | None = None, assignee: str | None = None, labels: List[str] | None = None, milestone: int | str | None = None, security_hole: str | None = None) Issue

Update an existing issue.

Parameters:
  • number – Repository-local issue number.

  • owner – Repository owner path.

  • repo – Repository name. Uses the client default when omitted.

  • title – Updated issue title.

  • body – Updated issue description.

  • state – Updated state such as reopen or close.

  • assignee – Updated assignee username.

  • labels – Replacement label names.

  • milestone – Updated milestone identifier.

  • security_hole – Whether the issue is private; form field described in the Issues API.

Returns:

Updated issue details.

list_comments(*, number: int | str, owner: str | None = None, repo: str | None = None, page: int | None = None, per_page: int | None = None) List[IssueComment]

List comments for an issue.

Parameters:
  • number – Repository-local issue number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path (name). Uses the client default when omitted.

  • page – Current page number (query).

  • per_page – Page size; maximum per REST API is typically 100.

Returns:

Issue comments.

create_comment(*, number: int | str, body: str, owner: str | None = None, repo: str | None = None) IssueComment

Create a comment on an issue.

Parameters:
  • number – Repository-local issue number.

  • body – Comment body text.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Created comment.

get_comment(*, comment_id: int | str, owner: str | None = None, repo: str | None = None) IssueComment

Get a single issue comment by identifier.

Parameters:
  • comment_id – Comment id from the API.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Issue comment.

update_comment(*, comment_id: int | str, body: str, owner: str | None = None, repo: str | None = None) IssueComment

Update an issue comment.

Parameters:
  • comment_id – Comment id from the API.

  • body – Updated comment body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Updated comment.

delete_comment(*, comment_id: int | str, owner: str | None = None, repo: str | None = None) None

Delete an issue comment.

Parameters:
  • comment_id – Comment id from the API.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

list_pull_requests(*, number: int | str, owner: str | None = None, repo: str | None = None) List[PullRequest]

List pull requests associated with an issue.

Parameters:
  • number – Repository-local issue number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Pull requests linked to the issue.

add_labels(*, number: int | str, labels: List[str], owner: str | None = None, repo: str | None = None) List[Label]

Add labels to an issue.

Parameters:
  • number – Repository-local issue number.

  • labels – Label names to add (request body is a JSON array per REST API).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Labels on the issue after the operation.

remove_label(*, number: int | str, name: str, owner: str | None = None, repo: str | None = None) None

Remove one label from an issue (REST path includes the label name).

Parameters:
  • number – Repository-local issue number.

  • name – Label name to remove.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

list_enterprise(*, enterprise: str, **params) List[Issue]

List enterprise issues visible to the caller.

Parameters:
  • enterprise – Enterprise path or login.

  • params – Additional query parameters accepted by GET .../enterprises/{enterprise}/issues.

Returns:

Enterprise-scoped issues.

list_user(**params) List[Issue]

List issues for the authenticated user.

Parameters:

params – Query parameters for GET /user/issues (filters, pagination, etc.).

Returns:

Issues assigned to or authored by the user, per API rules.

list_org(*, org: str, **params) List[Issue]

List organization issues visible to the current user.

Parameters:
  • org – Organization path or login.

  • params – Query parameters for GET .../orgs/{org}/issues.

Returns:

Organization-scoped issues.

get_enterprise_issue(*, enterprise: str, number: int | str) Issue

Get a specific enterprise issue.

Parameters:
  • enterprise – Enterprise path or login.

  • number – Enterprise issue id or number as accepted by the API path.

Returns:

Issue payload.

list_enterprise_comments(*, enterprise: str, number: int | str, **params) List[IssueComment]

List comments for an enterprise issue.

Parameters:
  • enterprise – Enterprise path or login.

  • number – Enterprise issue identifier in the path.

  • params – Optional pagination or filter query parameters.

Returns:

Comments on the enterprise issue.

list_enterprise_labels(*, enterprise: str, issue_id: int | str) List[Label]

List labels attached to an enterprise issue.

Parameters:
  • enterprise – Enterprise path or login.

  • issue_id – Enterprise issue id in the path segment .../issues/{issue_id}/labels.

Returns:

Labels on the issue.

list_operation_logs(*, owner: str, number: int | str, page: int | None = None, per_page: int | None = None) List[IssueOperationLog]

List operation (audit) logs for an issue.

Parameters:
  • owner – Repository owner path (path segment repos/{owner}/... for this endpoint).

  • number – Repository-local issue number.

  • page – Page number.

  • per_page – Page size.

Returns:

Operation log entries.

list_templates(*, owner: str | None = None, repo: str | None = None) List[RepositoryGitCodeTemplate]

List active issue templates under .gitcode/ for this repository.

Matches Markdown (.md, .markdown) and YAML (.yml / .yaml) paths whose names start with ISSUE_TEMPLATE under .gitcode/ (case-insensitive), including files inside localized directories such as .gitcode/ISSUE_TEMPLATE.en/.

Resolution tries the repository, then the owner’s .gitcode repository, then any parent main and parent/.gitcode pairs discovered from forks (each candidate is inspected with GET /repos/{owner}/{repo}; when fork is true, its parent’s repos are appended, deduplicated, and visited in order). The first source with matching templates wins.

Version 1.2.19: Now also supporting GitHub-mirrored repos with a .github/ folder.

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository name. Uses the client default when omitted.

Returns:

Template metadata entries (paths and SHAs); empty when none match.

get_template(*, path: str, owner: str | None = None, repo: str | None = None, encoding: str = 'utf-8', **decoding_kwargs) str

Load a single issue template file body from the default branch.

Uses the same resolution order as list_templates(). The path must match the active issue template naming convention (see GitCode .gitcode documentation).

Parameters:
  • path – Repository-relative path such as .gitcode/ISSUE_TEMPLATE_bug.md or .gitcode/ISSUE_TEMPLATE/config.yml.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository name. Uses the client default when omitted.

  • encoding – Codec to use when decoding raw file bytes. Default utf-8.

  • decoding_kwargs – Keyword arguments forwarded to bytes.decode(), such as errors ("strict", "ignore", or "replace").

Returns:

Decoded template file contents.

class LabelsResource(client: SyncAPIClient)

Bases: SyncResource, AbstractLabelsResource

Synchronous label endpoints.

Bind the resource to a synchronous API client.

list(*, owner: str | None = None, repo: str | None = None) List[Label]

List repository labels.

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

All labels defined on the repository.

create(*, name: str, color: str, owner: str | None = None, repo: str | None = None) Label

Create a repository label.

Parameters:
  • name – Label name.

  • color – Label color (typically a #RRGGBB hex string per API examples).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Created label.

update(*, original_name: str, owner: str | None = None, repo: str | None = None, name: str | None = None, color: str | None = None) Label

Update a repository label.

Parameters:
  • original_name – Current label name in the URL path.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • name – New label name, if renaming.

  • color – New color value.

Returns:

Updated label.

delete(*, name: str, owner: str | None = None, repo: str | None = None) None

Delete a repository label.

Parameters:
  • name – Label name in the path.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

clear_issue_labels(*, number: int | str, owner: str | None = None, repo: str | None = None) None

Remove all labels from an issue.

Parameters:
  • number – Repository-local issue number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

replace_issue_labels(*, number: int | str, labels: List[str], owner: str | None = None, repo: str | None = None) List[Label]

Replace all labels on an issue.

Parameters:
  • number – Repository-local issue number.

  • labels – Complete new label set (JSON array body).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Labels after replacement.

list_enterprise(*, enterprise: str, search: str | None = None, direction: str | None = None, page: int | None = None, per_page: int | None = None, api_version: str = 'v5') List[Label]

List labels for an enterprise, optionally using a different API version.

Parameters:
  • enterprise – Enterprise path or login.

  • search – Optional name search string.

  • direction – Sort direction for results.

  • page – Page number.

  • per_page – Page size.

  • api_versionv5 uses /api/v5/...; other values build /api/{version}/... on the same host.

Returns:

Enterprise label definitions.

class MembersResource(client: SyncAPIClient)

Bases: SyncResource, AbstractMembersResource

Synchronous repository member endpoints.

Bind the resource to a synchronous API client.

add_or_update(*, username: str, owner: str | None = None, repo: str | None = None, permission: str | None = None) RepoMember

Add or update repository member permissions.

Parameters:
  • username – Collaborator login.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • permission – Permission string (for example pull, push, admin per GitCode API).

Returns:

Collaborator record.

remove(*, username: str, owner: str | None = None, repo: str | None = None) None

Remove a repository member.

Parameters:
  • username – Collaborator login to remove.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

list(*, owner: str | None = None, repo: str | None = None, page: int | None = None, per_page: int | None = None) List[RepoCollaborator]

List repository members (collaborators).

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • page – Page number.

  • per_page – Page size.

Returns:

Collaborators with permission metadata.

get(*, username: str, owner: str | None = None, repo: str | None = None) RepositoryCollaboratorCheck

Check whether a user is a repository member.

get_permission(*, username: str, owner: str | None = None, repo: str | None = None) RepoMemberPermission

Get repository member permissions.

Parameters:
  • username – Collaborator login.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Effective permission for the user on the repository.

class MilestonesResource(client: SyncAPIClient)

Bases: SyncResource, AbstractMilestonesResource

Synchronous milestone endpoints.

Bind the resource to a synchronous API client.

list(*, owner: str | None = None, repo: str | None = None, **params) List[Milestone]

List milestones for a repository.

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • params – Query parameters accepted by the milestones listing (state, sort, pagination, etc.).

Returns:

Milestones.

get(*, number: int | str, owner: str | None = None, repo: str | None = None) Milestone

Get a single milestone.

Parameters:
  • number – Milestone number in the repository.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Milestone details.

create(*, title: str, due_on: str, owner: str | None = None, repo: str | None = None, description: str | None = None) Milestone

Create a milestone.

Parameters:
  • title – Milestone title.

  • due_on – Due date string in the format expected by the API (often ISO 8601).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • description – Optional description.

Returns:

Created milestone.

update(*, number: int | str, title: str, due_on: str, owner: str | None = None, repo: str | None = None, description: str | None = None, state: str | None = None) Milestone

Update a milestone.

Parameters:
  • number – Milestone number.

  • title – Updated title.

  • due_on – Updated due date.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • description – Updated description.

  • state – Milestone state such as open or closed per API.

Returns:

Updated milestone.

delete(*, number: int | str, owner: str | None = None, repo: str | None = None) None

Delete a milestone.

Parameters:
  • number – Milestone number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

class PullsResource(client: SyncAPIClient)

Bases: SyncResource, AbstractPullsResource

Synchronous pull request endpoints.

Bind the resource to a synchronous API client.

list(*, owner: str | None = None, repo: str | None = None, state: str | None = None, sort: str | None = None, direction: str | None = None, page: int | None = None, per_page: int | None = None, **params) List[PullRequest] | PullRequestCount

List pull requests for a repository.

When only_count is true in params (or passed via **params), the API returns a JSON object with counts per state instead of an array (see Pull Request API).

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path (name). Uses the client default when omitted.

  • state – PR state filter: all, open, closed, locked, merged (default all in API).

  • sort – Sort field, typically created or updated.

  • directionasc or desc (API default is usually desc).

  • page – Current page number.

  • per_page – Page size (max 100 per API documentation).

  • params – Extra query parameters from the Pull Request API, for example base, since, author, assignee, reviewer, milestone_number, labels (comma-separated), merged_after, merged_before, created_after, created_before, updated_after, updated_before, only_count (boolean), and ISO 8601 timestamps (URL-encoded when sent).

Returns:

A list of pull requests, or an APIObject for count-only responses.

get(*, number: int | str, owner: str | None = None, repo: str | None = None) PullRequest

Get a single pull request.

Parameters:
  • number – Pull request number in the repository.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Pull request details.

create(*, title: str, head: str, base: str, owner: str | None = None, repo: str | None = None, body: str | None = None, draft: bool | None = None, assignees: List[str] | None = None, testers: List[str] | None = None, labels: List[str] | None = None, milestone_number: int | None = None, issue: str | None = None, prune_source_branch: bool | None = None, squash: bool | None = None, squash_commit_message: str | None = None, fork_path: str | None = None) PullRequest

Create a pull request.

Parameters:
  • title – Pull request title.

  • head – Source branch ref (head branch, in forks use owner:branch like “SushiNinja:develop”).

  • base – Target branch ref (base branch).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • body – Description body.

  • draft – Whether to create as draft.

  • assignees – Assignee logins; sent as a comma-separated string per API.

  • testers – Tester logins; comma-separated in the JSON body.

  • labels – Label names; comma-separated in the JSON body.

  • milestone_number – Target milestone number.

  • issue – Related issue reference when supported by the API.

  • prune_source_branch – Whether to delete the source branch after merge when applicable.

  • squash – Squash-merge preference where supported.

  • squash_commit_message – Custom squash commit message.

  • fork_path – Fork owner/repo when opening a PR from a fork, like “SushiNinja/agent-core-contrib”.

Returns:

Created pull request.

update(*, number: int | str, owner: str | None = None, repo: str | None = None, title: str | None = None, body: str | None = None, state: str | None = None, base: str | None = None, labels: List[str] | None = None, draft: bool | None = None) PullRequest

Update a pull request.

Parameters:
  • number – Pull request number in the repository.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • title – New title.

  • body – New description.

  • state – New state as accepted by the API (for example close or reopen semantics).

  • base – New base branch name.

  • labels – Replacement labels; comma-separated in the JSON body.

  • draft – Draft flag.

Returns:

Updated pull request.

merge(*, number: int | str, owner: str | None = None, repo: str | None = None, merge_commit_message: str | None = None, squash: bool | None = None) MergeResult

Merge a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • merge_commit_message – Optional merge commit message.

  • squash – Whether to squash merge when supported.

Returns:

Merge result payload.

get_merge_status(*, number: int | str, owner: str | None = None, repo: str | None = None) MergeStatus

Get mergeability status for a pull request (GET on the merge resource).

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Merge status / mergeability information.

list_commits(*, number: int | str, owner: str | None = None, repo: str | None = None) List[APIObject]

List commits included in a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Commit objects (wrapped as APIObject).

list_files(*, number: int | str, owner: str | None = None, repo: str | None = None) List[PullRequestFile]

List files changed by a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

File change entries.

list_comments(*, number: int | str, owner: str | None = None, repo: str | None = None, page: int | None = None, per_page: int | None = None) List[PullRequestComment]

List comments on a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • page – Page number.

  • per_page – Page size.

Returns:

Pull request review comments.

create_comment(*, number: int | str, body: str, owner: str | None = None, repo: str | None = None, commit_id: str | None = None, path: str | None = None, position: int | None = None) PullRequestComment

Create a pull request (review) comment.

Parameters:
  • number – Pull request number.

  • body – Comment body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • commit_id – Commit SHA the comment applies to.

  • path – File path in the diff.

  • position – Line or diff position as defined by the API.

Returns:

Created comment.

get_comment(*, comment_id: int | str, owner: str | None = None, repo: str | None = None) PullRequestComment

Get a single pull request comment by id (global comment endpoint).

Parameters:
  • comment_id – Comment id.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Pull request comment.

update_comment(*, comment_id: int | str, body: str, owner: str | None = None, repo: str | None = None) PullRequestComment

Update a pull request comment.

Parameters:
  • comment_id – Comment id.

  • body – Updated body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Updated comment.

delete_comment(*, comment_id: int | str, owner: str | None = None, repo: str | None = None) None

Delete a pull request comment.

Parameters:
  • comment_id – Comment id.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

list_labels(*, number: int | str, owner: str | None = None, repo: str | None = None) List[Label]

List labels attached to a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Labels on the pull request.

add_labels(*, number: int | str, labels: List[str], owner: str | None = None, repo: str | None = None) List[Label]

Add labels to a pull request.

Parameters:
  • number – Pull request number.

  • labels – Label names (JSON array body per API).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Labels after the operation.

replace_labels(*, number: int | str, labels: List[str], owner: str | None = None, repo: str | None = None) List[Label]

Replace all labels on a pull request.

Parameters:
  • number – Pull request number.

  • labels – Complete new label set (JSON array body).

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Labels after replacement.

remove_label(*, number: int | str, label: str, owner: str | None = None, repo: str | None = None) None

Remove a label from a pull request.

Parameters:
  • number – Pull request number.

  • label – Label name to remove.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

request_review(*, number: int | str, owner: str | None = None, repo: str | None = None, event: str, body: str | None = None) None

Submit a pull request review event (approve, request changes, etc., per API).

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • event – Review event name as required by GitCode (for example APPROVE; see API docs).

  • body – Optional comment body accompanying the event.

Returns:

Review result object.

list_operation_logs(*, number: int | str, owner: str | None = None, repo: str | None = None, **params) List[PullRequestOperationLog]

List operation logs for a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • params – Additional query parameters accepted by the operate_logs endpoint.

Returns:

Log entries as generic API objects.

request_test(*, number: int | str, owner: str | None = None, repo: str | None = None, **payload) None

Request testing for a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • payload – JSON fields required by the test request endpoint.

Returns:

Test request result.

update_testers(*, number: int | str, testers: List[str], owner: str | None = None, repo: str | None = None) None

Replace pull request testers.

Parameters:
  • number – Pull request number.

  • testers – New tester list; serialized as a comma-separated testers field in JSON.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

API response payload.

add_testers(*, number: int | str, testers: List[str], owner: str | None = None, repo: str | None = None) List[UserSummary]

Add testers to a pull request.

Parameters:
  • number – Pull request number.

  • testers – Usernames to add; comma-separated in the JSON body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

API response payload.

update_assignees(*, number: int | str, assignees: List[str], owner: str | None = None, repo: str | None = None) None

Replace pull request assignees.

Parameters:
  • number – Pull request number.

  • assignees – New assignee list; comma-separated in the JSON body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

API response payload.

add_assignees(*, number: int | str, assignees: List[str], owner: str | None = None, repo: str | None = None) PullRequestAssigneeCount

Add assignees to a pull request.

Parameters:
  • number – Pull request number.

  • assignees – Usernames to add; comma-separated in the JSON body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

API response payload.

remove_assignees(*, number: int | str, assignees: List[str], owner: str | None = None, repo: str | None = None) None

Remove assignees from a pull request.

Parameters:
  • number – Pull request number.

  • assignees – Usernames to remove; comma-separated in the JSON body.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

list_issues(*, number: int | str, owner: str | None = None, repo: str | None = None) List[Issue]

List issues linked to a pull request.

Parameters:
  • number – Pull request number.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Linked issues.

list_enterprise(*, enterprise: str, **params) List[PullRequest]

List enterprise pull requests.

Parameters:
  • enterprise – Enterprise path or login.

  • params – Query parameters for the enterprise pull_requests listing.

Returns:

Pull requests in the enterprise scope.

list_org(*, org: str, **params) List[PullRequest]

List pull requests for an organization scope.

Parameters:
  • org – Organization path (GET .../org/{org}/pull_requests).

  • params – Query parameters accepted by that listing.

Returns:

Organization-scoped pull requests.

list_issue_pull_requests(*, enterprise: str, number: int | str) List[PullRequest]

List pull requests associated with an enterprise issue.

Parameters:
  • enterprise – Enterprise path or login.

  • number – Enterprise issue number or id in the path.

Returns:

Related pull requests.

list_templates(*, owner: str | None = None, repo: str | None = None) List[RepositoryGitCodeTemplate]

List active pull request templates under .gitcode/ for this repository.

Resolution tries the repository, then the owner’s .gitcode repository, then any parent main and parent/.gitcode pairs discovered from forks (each candidate is inspected with GET /repos/{owner}/{repo}; when fork is true, its parent’s repos are appended, deduplicated, and visited in order). The first source with matching templates wins.

Version 1.2.19: Now also supporting GitHub-mirrored repos with a .github/ folder.

Parameters:
  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

Returns:

Template metadata entries (paths and SHAs); empty when none match.

get_template(*, path: str, owner: str | None = None, repo: str | None = None, encoding: str = 'utf-8', **decoding_kwargs) str

Load a single pull request template file body from the default branch.

Uses the same resolution order as list_templates(). The path must match the active pull request template naming convention (see GitCode .gitcode documentation).

Parameters:
  • path – Repository-relative path such as .gitcode/PULL_REQUEST_TEMPLATE.md.

  • owner – Repository owner path. Uses the client default when omitted.

  • repo – Repository path. Uses the client default when omitted.

  • encoding – Codec to use when decoding raw file bytes. Default utf-8.

  • decoding_kwargs – Keyword arguments forwarded to bytes.decode(), such as errors ("strict", "ignore", or "replace").

Returns:

Decoded template file contents.