# GitHub API

Every handle of the GitHub fake: the `github` fixture, the people and objects a test creates on it, and what they read and wait for. How to test a GitHub app or agent, step by step, is in the [GitHub guide](https://channelstack.dev/docs/platforms/github).

Each call is shown in every SDK's language, with its required options (the table under it lists them all). Arguments go first; options are TypeScript's trailing object, Python's keyword arguments and Rust's builder setters. The variable names are the ones the calls return elsewhere on these pages, so `user` is a `GitHubUser` handle.

Besides the errors listed with each method, most methods can fail with [`action_requires`](https://channelstack.dev/docs/reference/api/errors#action-requires), [`cross_workspace_credential`](https://channelstack.dev/docs/reference/api/errors#cross-workspace-credential), [`fake_actor_in_live_world`](https://channelstack.dev/docs/reference/api/errors#fake-actor-in-live-world), [`internal`](https://channelstack.dev/docs/reference/api/errors#internal), [`invalid_argument`](https://channelstack.dev/docs/reference/api/errors#invalid-argument), [`live_misconfigured`](https://channelstack.dev/docs/reference/api/errors#live-misconfigured), [`live_not_allowlisted`](https://channelstack.dev/docs/reference/api/errors#live-not-allowlisted), [`not_found`](https://channelstack.dev/docs/reference/api/errors#not-found), [`session_not_found`](https://channelstack.dev/docs/reference/api/errors#session-not-found), [`unauthorized`](https://channelstack.dev/docs/reference/api/errors#unauthorized), [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): a bad request, a closed session, or live mode refusing or misconfigured.

## GitHubFixture

Returned by [`Session.github()`](https://channelstack.dev/docs/reference/api/client#github).

| Field    | Python / Rust | Type        |
| -------- | ------------- | ----------- |
| `app`    | `app`         | `GitHubApp` |
| `apiUrl` | `api_url`     | `string`    |
| `org`    | `org`         | `string`    |

### createUser()

Create a person in the org.

```ts title="TypeScript"
const user = await github.createUser({ login: "…" });
```

```python title="Python"
user = await github.create_user(login="…")
```

```rust title="Rust"
let user = github.create_user().login("…").await?;
```

| Parameter | Type                                            | Required |                                                                          |
| --------- | ----------------------------------------------- | -------- | ------------------------------------------------------------------------ |
| `login`   | `string`                                        | yes      | option                                                                   |
| `id`      | `number`                                        | no       | option                                                                   |
| `name`    | `string`                                        | no       | option                                                                   |
| `email`   | `string`                                        | no       | option                                                                   |
| `role`    | `"member" \| "admin" \| "outside_collaborator"` | no       | option                                                                   |
| `token`   | `string`                                        | no       | option; read from `CHANNELSTACK_GITHUB_USER_{login}_TOKEN` when left out |

**Returns** [`GitHubUser`](https://channelstack.dev/docs/reference/api/github#githubuser).

### users()

The people this session created.

```ts title="TypeScript"
const users = await github.users();
```

```python title="Python"
users = await github.users()
```

```rust title="Rust"
let users = github.users().await?;
```

**Returns** [`GitHubUsers`](https://channelstack.dev/docs/reference/api/github#githubusers).

### createRepo()

Create a repository in the org. The App hears about it only when it is listed in `apps`: an App must be installed on a repository.

```ts title="TypeScript"
const repo = await github.createRepo({ name: "…" });
```

```python title="Python"
repo = await github.create_repo(name="…")
```

```rust title="Rust"
let repo = github.create_repo().name("…").await?;
```

| Parameter       | Python / Rust    | Type                                                                                                             | Required |        |
| --------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------- | -------- | ------ |
| `name`          | `name`           | `string`                                                                                                         | no       | option |
| `private`       | `private`        | `boolean`                                                                                                        | no       | option |
| `defaultBranch` | `default_branch` | `string`                                                                                                         | no       | option |
| `files`         | `files`          | `string \| FileInput[]`                                                                                          | no       | option |
| `collaborators` | `collaborators`  | `Array<GitHubUser \| { user: GitHubUser; permission?: "read" \| "triage" \| "write" \| "maintain" \| "admin" }>` | no       | option |
| `apps`          | `apps`           | `GitHubApp[]`                                                                                                    | no       | option |
| `labels`        | `labels`         | `Array<string \| { name: string; color?: string; description?: string }>`                                        | no       | option |

**Returns** [`GitHubRepo`](https://channelstack.dev/docs/reference/api/github#githubrepo).

### repos()

The repositories this session created.

```ts title="TypeScript"
const repos = await github.repos();
```

```python title="Python"
repos = await github.repos()
```

```rust title="Rust"
let repos = github.repos().await?;
```

**Returns** [`GitHubRepos`](https://channelstack.dev/docs/reference/api/github#githubrepos).

### issues()

The issues and pull requests in this session's repositories, read again from GitHub live, the most recently updated last.

```ts title="TypeScript"
const issues = await github.issues();
```

```python title="Python"
issues = await github.issues()
```

```rust title="Rust"
let issues = github.issues().await?;
```

**Returns** [`GitHubIssues`](https://channelstack.dev/docs/reference/api/github#githubissues).

### installationId()

The id of the built-in App's installation, for a repository it is installed on. The same as `github.app.installationId(repo)`.

```ts title="TypeScript"
const result = await github.installationId(repo);
```

```python title="Python"
result = await github.installation_id(repo)
```

```rust title="Rust"
let result = github.installation_id(&repo).await?;
```

| Parameter | Type         | Required |            |
| --------- | ------------ | -------- | ---------- |
| `repo`    | `GitHubRepo` | yes      | positional |

**Returns** `number`.

### createApp()

Make another GitHub App on the org, with its own App id, bot user, installation, private key and webhook secret (decision 0027), or return the one made with this name and settings. It reaches no repository until it is installed on one; its webhooks go to CHANNELSTACK_GITHUB_APP\_\<NAME>\_WEBHOOK_URL.

```ts title="TypeScript"
const app = await github.createApp({ name: "…" });
```

```python title="Python"
app = await github.create_app(name="…")
```

```rust title="Rust"
let app = github.create_app().name("…").await?;
```

| Parameter     | Type                                | Required |        |
| ------------- | ----------------------------------- | -------- | ------ |
| `name`        | `string`                            | yes      | option |
| `permissions` | `Record<string, "read" \| "write">` | no       | option |
| `events`      | `string[]`                          | no       | option |

**Returns** [`GitHubApp`](https://channelstack.dev/docs/reference/api/github#githubapp).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### apps()

The Apps this session used: the built-in one first, then each it got from `createApp`, in the order it first did. Another session's are `not_found` here.

```ts title="TypeScript"
const apps = await github.apps();
```

```python title="Python"
apps = await github.apps()
```

```rust title="Rust"
let apps = github.apps().await?;
```

**Returns** [`GitHubApps`](https://channelstack.dev/docs/reference/api/github#githubapps).

### deliveries()

Every webhook channelstack sent the agent for this session, with every attempt.

```ts title="TypeScript"
const deliveries = await github.deliveries({ type: "…" });
```

```python title="Python"
deliveries = await github.deliveries(type="…")
```

```rust title="Rust"
let deliveries = github.deliveries().r#type("…").await?;
```

| Parameter  | Python / Rust     | Type         | Required |        |
| ---------- | ----------------- | ------------ | -------- | ------ |
| `type`     | `type` · `r#type` | `string`     | no       | option |
| `resource` | `resource`        | `GitHubRepo` | no       | option |
| `app`      | `app`             | `GitHubApp`  | no       | option |

**Returns** [`GitHubDeliveries`](https://channelstack.dev/docs/reference/api/github#githubdeliveries).

### calls()

The REST calls the agent made about this session's repositories. Calls about no repository (`GET /app`) are in no session.

```ts title="TypeScript"
const apiCalls = await github.calls({ operation: "…" });
```

```python title="Python"
api_calls = await github.calls(operation="…")
```

```rust title="Rust"
let api_calls = github.calls().operation("…").await?;
```

| Parameter   | Type             | Required |        |
| ----------- | ---------------- | -------- | ------ |
| `operation` | `string`         | no       | option |
| `error`     | `true \| string` | no       | option |

**Returns** [`GitHubApiCalls`](https://channelstack.dev/docs/reference/api/github#githubapicalls).

**Live:** needs proxy mode: GitHub doesn't report the App's calls; proxy mode sees them. Proxy mode doesn't read the app's calls back live yet ([#24](https://github.com/christian-bromann/channelstack/issues/24)), so for now the call is refused with [`action_requires`](https://channelstack.dev/docs/reference/api/errors#action-requires) and the test is skipped.

### appCalls()

The App's REST calls that are about no repository of any session: its own endpoints and the token exchange. They belong to no session, so every session reads the same list. Only calls that authenticated as the App or its installation are on it.

```ts title="TypeScript"
const appCalls = await github.appCalls({ operation: "…" });
```

```python title="Python"
app_calls = await github.app_calls(operation="…")
```

```rust title="Rust"
let app_calls = github.app_calls().operation("…").await?;
```

| Parameter   | Type             | Required |        |
| ----------- | ---------------- | -------- | ------ |
| `operation` | `string`         | no       | option |
| `error`     | `true \| string` | no       | option |

**Returns** [`GitHubAppCalls`](https://channelstack.dev/docs/reference/api/github#githubappcalls).

**Live:** needs proxy mode: GitHub doesn't report the App's calls; proxy mode sees them. Proxy mode doesn't read the app's calls back live yet ([#24](https://github.com/christian-bromann/channelstack/issues/24)), so for now the call is refused with [`action_requires`](https://channelstack.dev/docs/reference/api/errors#action-requires) and the test is skipped.

### waitForCall()

Waits for the next API call from the agent after the last one this handle returned: it polls `calls()` and never sleeps longer than it must.

```ts title="TypeScript"
const apiCall = await github.waitForCall({ operation: "…" });
```

```python title="Python"
api_call = await github.wait_for_call(operation="…")
```

```rust title="Rust"
let api_call = github.wait_for_call().operation("…").await?;
```

| Parameter   | Type             | Required |             |
| ----------- | ---------------- | -------- | ----------- |
| `operation` | `string`         | no       | filter      |
| `error`     | `true \| string` | no       | filter      |
| `timeout`   | `Duration`       | no       | default 10s |

**Returns** [`GitHubApiCall`](https://channelstack.dev/docs/reference/api/github#githubapicall). When the time is up, it fails with what it was waiting for.

## GitHubApp

Returned by [`GitHubFixture.createApp()`](https://channelstack.dev/docs/reference/api/github#createapp).

| Field           | Python / Rust    | Type     |
| --------------- | ---------------- | -------- |
| `id`            | `id`             | `string` |
| `name`          | `name`           | `string` |
| `kind`          | `kind`           | `"app"`  |
| `slug`          | `slug`           | `string` |
| `botLogin`      | `bot_login`      | `string` |
| `botUserId`     | `bot_user_id`    | `string` |
| `appId`         | `app_id`         | `number` |
| `privateKey`    | `private_key`    | `string` |
| `webhookSecret` | `webhook_secret` | `string` |

### installationId()

The id of this App's installation, for a repository it is installed on.

```ts title="TypeScript"
const result = await app.installationId(repo);
```

```python title="Python"
result = await app.installation_id(repo)
```

```rust title="Rust"
let result = app.installation_id(&repo).await?;
```

| Parameter | Type         | Required |            |
| --------- | ------------ | -------- | ---------- |
| `repo`    | `GitHubRepo` | yes      | positional |

**Returns** `number`.

### push()

Push a commit to a branch (created from the default branch if it isn't there). Sends `push`, and `pull_request` `synchronize` for open pull requests from it.

```ts title="TypeScript"
const commit = await app.push(changes, { repo, branch: "…" });
```

```python title="Python"
commit = await app.push(changes, repo=repo, branch="…")
```

```rust title="Rust"
let commit = app.push(changes).repo(&repo).branch("…").await?;
```

| Parameter | Type                                            | Required |            |
| --------- | ----------------------------------------------- | -------- | ---------- |
| `changes` | `FileInput[] \| Record<string, string \| null>` | yes      | positional |
| `repo`    | `GitHubRepo`                                    | yes      | option     |
| `branch`  | `string`                                        | yes      | option     |
| `message` | `string`                                        | no       | option     |

**Returns** [`GitHubCommit`](https://channelstack.dev/docs/reference/api/github#githubcommit).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### openIssue()

Open an issue. Sends `issues` (action `opened`).

```ts title="TypeScript"
const result = await app.openIssue(issue, { repo });
```

```python title="Python"
result = await app.open_issue(issue, repo=repo)
```

```rust title="Rust"
let result = app.open_issue(issue).repo(&repo).await?;
```

| Parameter | Type                                                                                              | Required |            |
| --------- | ------------------------------------------------------------------------------------------------- | -------- | ---------- |
| `issue`   | `{ title: string; body?: string; labels?: string[]; assignees?: Array<GitHubUser \| GitHubApp> }` | yes      | positional |
| `repo`    | `GitHubRepo`                                                                                      | yes      | option     |

**Returns** [`GitHubIssue`](https://channelstack.dev/docs/reference/api/github#githubissue).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### openPullRequest()

Open a pull request. With `changes`, they are pushed to `from` first; without, `from` is an existing branch. Sends `pull_request` (action `opened`).

```ts title="TypeScript"
const pullRequest = await app.openPullRequest(pr, { repo });
```

```python title="Python"
pull_request = await app.open_pull_request(pr, repo=repo)
```

```rust title="Rust"
let pull_request = app.open_pull_request(pr).repo(&repo).await?;
```

| Parameter | Type                                                                                                                                                                                 | Required |            |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ---------- |
| `pr`      | `{ from: string; to?: string; title?: string; body?: string; changes?: FileInput[] \| Record<string, string \| null>; draft?: boolean; reviewers?: Array<GitHubUser \| GitHubApp> }` | yes      | positional |
| `repo`    | `GitHubRepo`                                                                                                                                                                         | yes      | option     |

**Returns** [`GitHubPullRequest`](https://channelstack.dev/docs/reference/api/github#githubpullrequest).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### editIssue()

Edit the title or the body of an issue or a pull request. Sends `issues` or `pull_request` (action `edited`).

```ts title="TypeScript"
const delivery = await app.editIssue(changes, { issue });
```

```python title="Python"
delivery = await app.edit_issue(changes, issue=issue)
```

```rust title="Rust"
let delivery = app.edit_issue(changes).issue(&issue).await?;
```

| Parameter | Type                                | Required |            |
| --------- | ----------------------------------- | -------- | ---------- |
| `changes` | `{ title?: string; body?: string }` | yes      | positional |
| `issue`   | `GitHubIssue`                       | yes      | option     |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### close()

Close an issue or a pull request. Sends `issues` or `pull_request` (action `closed`).

```ts title="TypeScript"
const delivery = await app.close({ issue });
```

```python title="Python"
delivery = await app.close(issue=issue)
```

```rust title="Rust"
let delivery = app.close().issue(&issue).await?;
```

| Parameter | Type          | Required |        |
| --------- | ------------- | -------- | ------ |
| `issue`   | `GitHubIssue` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### reopen()

Reopen an issue or a pull request. Sends `issues` or `pull_request` (action `reopened`).

```ts title="TypeScript"
const delivery = await app.reopen({ issue });
```

```python title="Python"
delivery = await app.reopen(issue=issue)
```

```rust title="Rust"
let delivery = app.reopen().issue(&issue).await?;
```

| Parameter | Type          | Required |        |
| --------- | ------------- | -------- | ------ |
| `issue`   | `GitHubIssue` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### label()

Put labels on an issue or a pull request. Sends one `labeled` event per label.

```ts title="TypeScript"
const labelDeliveries = await app.label(labels, { issue });
```

```python title="Python"
label_deliveries = await app.label(labels, issue=issue)
```

```rust title="Rust"
let label_deliveries = app.label(labels).issue(&issue).await?;
```

| Parameter | Type                 | Required |            |
| --------- | -------------------- | -------- | ---------- |
| `labels`  | `string \| string[]` | yes      | positional |
| `issue`   | `GitHubIssue`        | yes      | option     |

**Returns** [`GitHubLabelDeliveries`](https://channelstack.dev/docs/reference/api/github#githublabeldeliveries).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### unlabel()

Take labels off an issue or a pull request. Sends one `unlabeled` event per label.

```ts title="TypeScript"
const unlabelDeliveries = await app.unlabel(labels, { issue });
```

```python title="Python"
unlabel_deliveries = await app.unlabel(labels, issue=issue)
```

```rust title="Rust"
let unlabel_deliveries = app.unlabel(labels).issue(&issue).await?;
```

| Parameter | Type                 | Required |            |
| --------- | -------------------- | -------- | ---------- |
| `labels`  | `string \| string[]` | yes      | positional |
| `issue`   | `GitHubIssue`        | yes      | option     |

**Returns** [`GitHubUnlabelDeliveries`](https://channelstack.dev/docs/reference/api/github#githubunlabeldeliveries).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### assign()

Assign people or the App's bot. Sends one `assigned` event per assignee.

```ts title="TypeScript"
const assignDeliveries = await app.assign(assignees, { issue });
```

```python title="Python"
assign_deliveries = await app.assign(assignees, issue=issue)
```

```rust title="Rust"
let assign_deliveries = app.assign(assignees).issue(&issue).await?;
```

| Parameter   | Type                                                        | Required |            |
| ----------- | ----------------------------------------------------------- | -------- | ---------- |
| `assignees` | `GitHubUser \| GitHubApp \| Array<GitHubUser \| GitHubApp>` | yes      | positional |
| `issue`     | `GitHubIssue`                                               | yes      | option     |

**Returns** [`GitHubAssignDeliveries`](https://channelstack.dev/docs/reference/api/github#githubassigndeliveries).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### comment()

Comment on an issue or a pull request's conversation. Sends `issue_comment` (action `created`).

```ts title="TypeScript"
const comment = await app.comment("…", { issue });
```

```python title="Python"
comment = await app.comment("…", issue=issue)
```

```rust title="Rust"
let comment = app.comment("…").issue(&issue).await?;
```

| Parameter | Type          | Required |            |
| --------- | ------------- | -------- | ---------- |
| `body`    | `string`      | yes      | positional |
| `issue`   | `GitHubIssue` | yes      | option     |

**Returns** [`GitHubComment`](https://channelstack.dev/docs/reference/api/github#githubcomment).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### edit()

Edit a conversation comment or a comment on the diff. Sends the comment's event with action `edited`.

```ts title="TypeScript"
const delivery = await app.edit("…", { comment });
```

```python title="Python"
delivery = await app.edit("…", comment=comment)
```

```rust title="Rust"
let delivery = app.edit("…").comment(&comment).await?;
```

| Parameter | Type                                   | Required |            |
| --------- | -------------------------------------- | -------- | ---------- |
| `body`    | `string`                               | yes      | positional |
| `comment` | `GitHubComment \| GitHubReviewComment` | yes      | option     |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### delete()

Delete a conversation comment or a comment on the diff. Sends the comment's event with action `deleted`.

```ts title="TypeScript"
const delivery = await app.delete({ comment });
```

```python title="Python"
delivery = await app.delete(comment=comment)
```

```rust title="Rust"
let delivery = app.delete().comment(&comment).await?;
```

| Parameter | Type                                   | Required |        |
| --------- | -------------------------------------- | -------- | ------ |
| `comment` | `GitHubComment \| GitHubReviewComment` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### react()

React to an issue, a pull request or a comment. GitHub sends no webhook for a reaction.

```ts title="TypeScript"
await app.react(content, { issue });
```

```python title="Python"
await app.react(content, issue=issue)
```

```rust title="Rust"
app.react(content).issue(&issue).await?;
```

| Parameter | Type                                                                                 | Required |            |
| --------- | ------------------------------------------------------------------------------------ | -------- | ---------- |
| `content` | `"+1" \| "-1" \| "laugh" \| "confused" \| "heart" \| "hooray" \| "rocket" \| "eyes"` | yes      | positional |
| `issue`   | `GitHubIssue`                                                                        | no       | option     |
| `comment` | `GitHubComment \| GitHubReviewComment`                                               | no       | option     |

**Returns** nothing.

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### minimize()

Hide a comment as outdated, spam, off-topic or resolved. GitHub sends no webhook for it.

```ts title="TypeScript"
await app.minimize({ comment });
```

```python title="Python"
await app.minimize(comment=comment)
```

```rust title="Rust"
app.minimize().comment(&comment).await?;
```

| Parameter | Type                                                | Required |        |
| --------- | --------------------------------------------------- | -------- | ------ |
| `comment` | `GitHubComment`                                     | yes      | option |
| `reason`  | `"OUTDATED" \| "SPAM" \| "OFF_TOPIC" \| "RESOLVED"` | no       | option |

**Returns** nothing.

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### review()

Submit a review, with comments on the diff if any. Sends `pull_request_review`, and one `pull_request_review_comment` per comment.

```ts title="TypeScript"
const result = await app.review(review);
```

```python title="Python"
result = await app.review(review)
```

```rust title="Rust"
let result = app.review(review).await?;
```

| Parameter | Type                                                                                                                                                                                                         | Required |            |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ---------- |
| `review`  | `{ pr: GitHubPullRequest; event: "COMMENT" \| "APPROVE" \| "REQUEST_CHANGES"; body?: string; comments?: Array<{ path: string; line: number; side?: "LEFT" \| "RIGHT"; startLine?: number; body: string }> }` | yes      | positional |

**Returns** [`GitHubReview`](https://channelstack.dev/docs/reference/api/github#githubreview).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### reviewComment()

One comment on the diff, outside a review. Sends `pull_request_review_comment`.

```ts title="TypeScript"
const reviewComment = await app.reviewComment("…", { pr, path: "…", line });
```

```python title="Python"
review_comment = await app.review_comment("…", pr=pr, path="…", line=line)
```

```rust title="Rust"
let review_comment = app.review_comment("…").pr(&pr).path("…").line(line).await?;
```

| Parameter | Type                | Required |            |
| --------- | ------------------- | -------- | ---------- |
| `body`    | `string`            | yes      | positional |
| `pr`      | `GitHubPullRequest` | yes      | option     |
| `path`    | `string`            | yes      | option     |
| `line`    | `number`            | yes      | option     |
| `side`    | `"LEFT" \| "RIGHT"` | no       | option     |

**Returns** [`GitHubReviewComment`](https://channelstack.dev/docs/reference/api/github#githubreviewcomment).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### reply()

Reply in a thread on the diff. Sends `pull_request_review_comment`.

```ts title="TypeScript"
const reviewComment = await app.reply("…", { comment });
```

```python title="Python"
review_comment = await app.reply("…", comment=comment)
```

```rust title="Rust"
let review_comment = app.reply("…").comment(&comment).await?;
```

| Parameter | Type                  | Required |            |
| --------- | --------------------- | -------- | ---------- |
| `body`    | `string`              | yes      | positional |
| `comment` | `GitHubReviewComment` | yes      | option     |

**Returns** [`GitHubReviewComment`](https://channelstack.dev/docs/reference/api/github#githubreviewcomment).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### resolve()

Resolve a thread on the diff. Sends `pull_request_review_thread`.

```ts title="TypeScript"
const delivery = await app.resolve({ comment });
```

```python title="Python"
delivery = await app.resolve(comment=comment)
```

```rust title="Rust"
let delivery = app.resolve().comment(&comment).await?;
```

| Parameter | Type                  | Required |        |
| --------- | --------------------- | -------- | ------ |
| `comment` | `GitHubReviewComment` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### unresolve()

Reopen a thread on the diff. Sends `pull_request_review_thread`.

```ts title="TypeScript"
const delivery = await app.unresolve({ comment });
```

```python title="Python"
delivery = await app.unresolve(comment=comment)
```

```rust title="Rust"
let delivery = app.unresolve().comment(&comment).await?;
```

| Parameter | Type                  | Required |        |
| --------- | --------------------- | -------- | ------ |
| `comment` | `GitHubReviewComment` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### requestReview()

Request a review from people or the App's bot. Sends `pull_request` (action `review_requested`) per reviewer.

```ts title="TypeScript"
const delivery = await app.requestReview(reviewers, { pr });
```

```python title="Python"
delivery = await app.request_review(reviewers, pr=pr)
```

```rust title="Rust"
let delivery = app.request_review(reviewers).pr(&pr).await?;
```

| Parameter   | Type                                                        | Required |            |
| ----------- | ----------------------------------------------------------- | -------- | ---------- |
| `reviewers` | `GitHubUser \| GitHubApp \| Array<GitHubUser \| GitHubApp>` | yes      | positional |
| `pr`        | `GitHubPullRequest`                                         | yes      | option     |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### markReady()

Mark a draft pull request as ready for review. Sends `pull_request` (action `ready_for_review`).

```ts title="TypeScript"
const delivery = await app.markReady({ pr });
```

```python title="Python"
delivery = await app.mark_ready(pr=pr)
```

```rust title="Rust"
let delivery = app.mark_ready().pr(&pr).await?;
```

| Parameter | Type                | Required |        |
| --------- | ------------------- | -------- | ------ |
| `pr`      | `GitHubPullRequest` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

### merge()

Merge a pull request. Sends `push` for the base branch, then `pull_request` (action `closed`, merged).

```ts title="TypeScript"
const delivery = await app.merge({ pr });
```

```python title="Python"
delivery = await app.merge(pr=pr)
```

```rust title="Rust"
let delivery = app.merge().pr(&pr).await?;
```

| Parameter | Type                              | Required |        |
| --------- | --------------------------------- | -------- | ------ |
| `pr`      | `GitHubPullRequest`               | yes      | option |
| `method`  | `"merge" \| "squash" \| "rebase"` | no       | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`not_allowed`](https://channelstack.dev/docs/reference/api/errors#not-allowed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

## GitHubUser

Returned by [`GitHubFixture.createUser()`](https://channelstack.dev/docs/reference/api/github#createuser).

| Field         | Python / Rust  | Type                                            |
| ------------- | -------------- | ----------------------------------------------- |
| `id`          | `id`           | `string`                                        |
| `name`        | `name`         | `string`                                        |
| `kind`        | `kind`         | `"user"`                                        |
| `login`       | `login`        | `string`                                        |
| `numericId`   | `numeric_id`   | `number`                                        |
| `displayName` | `display_name` | `string \| undefined`                           |
| `email`       | `email`        | `string \| undefined`                           |
| `role`        | `role`         | `"member" \| "admin" \| "outside_collaborator"` |

### push()

Push a commit to a branch (created from the default branch if it isn't there). Sends `push`, and `pull_request` `synchronize` for open pull requests from it.

```ts title="TypeScript"
const commit = await user.push(changes, { repo, branch: "…" });
```

```python title="Python"
commit = await user.push(changes, repo=repo, branch="…")
```

```rust title="Rust"
let commit = user.push(changes).repo(&repo).branch("…").await?;
```

| Parameter | Type                                            | Required |            |
| --------- | ----------------------------------------------- | -------- | ---------- |
| `changes` | `FileInput[] \| Record<string, string \| null>` | yes      | positional |
| `repo`    | `GitHubRepo`                                    | yes      | option     |
| `branch`  | `string`                                        | yes      | option     |
| `message` | `string`                                        | no       | option     |

**Returns** [`GitHubCommit`](https://channelstack.dev/docs/reference/api/github#githubcommit).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### openIssue()

Open an issue. Sends `issues` (action `opened`).

```ts title="TypeScript"
const result = await user.openIssue(issue, { repo });
```

```python title="Python"
result = await user.open_issue(issue, repo=repo)
```

```rust title="Rust"
let result = user.open_issue(issue).repo(&repo).await?;
```

| Parameter | Type                                                                                              | Required |            |
| --------- | ------------------------------------------------------------------------------------------------- | -------- | ---------- |
| `issue`   | `{ title: string; body?: string; labels?: string[]; assignees?: Array<GitHubUser \| GitHubApp> }` | yes      | positional |
| `repo`    | `GitHubRepo`                                                                                      | yes      | option     |

**Returns** [`GitHubIssue`](https://channelstack.dev/docs/reference/api/github#githubissue).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

### openPullRequest()

Open a pull request. With `changes`, they are pushed to `from` first; without, `from` is an existing branch. Sends `pull_request` (action `opened`).

```ts title="TypeScript"
const pullRequest = await user.openPullRequest(pr, { repo });
```

```python title="Python"
pull_request = await user.open_pull_request(pr, repo=repo)
```

```rust title="Rust"
let pull_request = user.open_pull_request(pr).repo(&repo).await?;
```

| Parameter | Type                                                                                                                                                                                 | Required |            |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ---------- |
| `pr`      | `{ from: string; to?: string; title?: string; body?: string; changes?: FileInput[] \| Record<string, string \| null>; draft?: boolean; reviewers?: Array<GitHubUser \| GitHubApp> }` | yes      | positional |
| `repo`    | `GitHubRepo`                                                                                                                                                                         | yes      | option     |

**Returns** [`GitHubPullRequest`](https://channelstack.dev/docs/reference/api/github#githubpullrequest).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### editIssue()

Edit the title or the body of an issue or a pull request. Sends `issues` or `pull_request` (action `edited`).

```ts title="TypeScript"
const delivery = await user.editIssue(changes, { issue });
```

```python title="Python"
delivery = await user.edit_issue(changes, issue=issue)
```

```rust title="Rust"
let delivery = user.edit_issue(changes).issue(&issue).await?;
```

| Parameter | Type                                | Required |            |
| --------- | ----------------------------------- | -------- | ---------- |
| `changes` | `{ title?: string; body?: string }` | yes      | positional |
| `issue`   | `GitHubIssue`                       | yes      | option     |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

### close()

Close an issue or a pull request. Sends `issues` or `pull_request` (action `closed`).

```ts title="TypeScript"
const delivery = await user.close({ issue });
```

```python title="Python"
delivery = await user.close(issue=issue)
```

```rust title="Rust"
let delivery = user.close().issue(&issue).await?;
```

| Parameter | Type          | Required |        |
| --------- | ------------- | -------- | ------ |
| `issue`   | `GitHubIssue` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

### reopen()

Reopen an issue or a pull request. Sends `issues` or `pull_request` (action `reopened`).

```ts title="TypeScript"
const delivery = await user.reopen({ issue });
```

```python title="Python"
delivery = await user.reopen(issue=issue)
```

```rust title="Rust"
let delivery = user.reopen().issue(&issue).await?;
```

| Parameter | Type          | Required |        |
| --------- | ------------- | -------- | ------ |
| `issue`   | `GitHubIssue` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

### label()

Put labels on an issue or a pull request. Sends one `labeled` event per label.

```ts title="TypeScript"
const labelDeliveries = await user.label(labels, { issue });
```

```python title="Python"
label_deliveries = await user.label(labels, issue=issue)
```

```rust title="Rust"
let label_deliveries = user.label(labels).issue(&issue).await?;
```

| Parameter | Type                 | Required |            |
| --------- | -------------------- | -------- | ---------- |
| `labels`  | `string \| string[]` | yes      | positional |
| `issue`   | `GitHubIssue`        | yes      | option     |

**Returns** [`GitHubLabelDeliveries`](https://channelstack.dev/docs/reference/api/github#githublabeldeliveries).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

### unlabel()

Take labels off an issue or a pull request. Sends one `unlabeled` event per label.

```ts title="TypeScript"
const unlabelDeliveries = await user.unlabel(labels, { issue });
```

```python title="Python"
unlabel_deliveries = await user.unlabel(labels, issue=issue)
```

```rust title="Rust"
let unlabel_deliveries = user.unlabel(labels).issue(&issue).await?;
```

| Parameter | Type                 | Required |            |
| --------- | -------------------- | -------- | ---------- |
| `labels`  | `string \| string[]` | yes      | positional |
| `issue`   | `GitHubIssue`        | yes      | option     |

**Returns** [`GitHubUnlabelDeliveries`](https://channelstack.dev/docs/reference/api/github#githubunlabeldeliveries).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

### assign()

Assign people or the App's bot. Sends one `assigned` event per assignee.

```ts title="TypeScript"
const assignDeliveries = await user.assign(assignees, { issue });
```

```python title="Python"
assign_deliveries = await user.assign(assignees, issue=issue)
```

```rust title="Rust"
let assign_deliveries = user.assign(assignees).issue(&issue).await?;
```

| Parameter   | Type                                                        | Required |            |
| ----------- | ----------------------------------------------------------- | -------- | ---------- |
| `assignees` | `GitHubUser \| GitHubApp \| Array<GitHubUser \| GitHubApp>` | yes      | positional |
| `issue`     | `GitHubIssue`                                               | yes      | option     |

**Returns** [`GitHubAssignDeliveries`](https://channelstack.dev/docs/reference/api/github#githubassigndeliveries).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

### comment()

Comment on an issue or a pull request's conversation. Sends `issue_comment` (action `created`).

```ts title="TypeScript"
const comment = await user.comment("…", { issue });
```

```python title="Python"
comment = await user.comment("…", issue=issue)
```

```rust title="Rust"
let comment = user.comment("…").issue(&issue).await?;
```

| Parameter | Type          | Required |            |
| --------- | ------------- | -------- | ---------- |
| `body`    | `string`      | yes      | positional |
| `issue`   | `GitHubIssue` | yes      | option     |

**Returns** [`GitHubComment`](https://channelstack.dev/docs/reference/api/github#githubcomment).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

### edit()

Edit a conversation comment or a comment on the diff. Sends the comment's event with action `edited`.

```ts title="TypeScript"
const delivery = await user.edit("…", { comment });
```

```python title="Python"
delivery = await user.edit("…", comment=comment)
```

```rust title="Rust"
let delivery = user.edit("…").comment(&comment).await?;
```

| Parameter | Type                                   | Required |            |
| --------- | -------------------------------------- | -------- | ---------- |
| `body`    | `string`                               | yes      | positional |
| `comment` | `GitHubComment \| GitHubReviewComment` | yes      | option     |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

### delete()

Delete a conversation comment or a comment on the diff. Sends the comment's event with action `deleted`.

```ts title="TypeScript"
const delivery = await user.delete({ comment });
```

```python title="Python"
delivery = await user.delete(comment=comment)
```

```rust title="Rust"
let delivery = user.delete().comment(&comment).await?;
```

| Parameter | Type                                   | Required |        |
| --------- | -------------------------------------- | -------- | ------ |
| `comment` | `GitHubComment \| GitHubReviewComment` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

### react()

React to an issue, a pull request or a comment. GitHub sends no webhook for a reaction.

```ts title="TypeScript"
await user.react(content, { issue });
```

```python title="Python"
await user.react(content, issue=issue)
```

```rust title="Rust"
user.react(content).issue(&issue).await?;
```

| Parameter | Type                                                                                 | Required |            |
| --------- | ------------------------------------------------------------------------------------ | -------- | ---------- |
| `content` | `"+1" \| "-1" \| "laugh" \| "confused" \| "heart" \| "hooray" \| "rocket" \| "eyes"` | yes      | positional |
| `issue`   | `GitHubIssue`                                                                        | no       | option     |
| `comment` | `GitHubComment \| GitHubReviewComment`                                               | no       | option     |

**Returns** nothing.

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

### minimize()

Hide a comment as outdated, spam, off-topic or resolved. GitHub sends no webhook for it.

```ts title="TypeScript"
await user.minimize({ comment });
```

```python title="Python"
await user.minimize(comment=comment)
```

```rust title="Rust"
user.minimize().comment(&comment).await?;
```

| Parameter | Type                                                | Required |        |
| --------- | --------------------------------------------------- | -------- | ------ |
| `comment` | `GitHubComment`                                     | yes      | option |
| `reason`  | `"OUTDATED" \| "SPAM" \| "OFF_TOPIC" \| "RESOLVED"` | no       | option |

**Returns** nothing.

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### review()

Submit a review, with comments on the diff if any. Sends `pull_request_review`, and one `pull_request_review_comment` per comment.

```ts title="TypeScript"
const result = await user.review(review);
```

```python title="Python"
result = await user.review(review)
```

```rust title="Rust"
let result = user.review(review).await?;
```

| Parameter | Type                                                                                                                                                                                                         | Required |            |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ---------- |
| `review`  | `{ pr: GitHubPullRequest; event: "COMMENT" \| "APPROVE" \| "REQUEST_CHANGES"; body?: string; comments?: Array<{ path: string; line: number; side?: "LEFT" \| "RIGHT"; startLine?: number; body: string }> }` | yes      | positional |

**Returns** [`GitHubReview`](https://channelstack.dev/docs/reference/api/github#githubreview).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### reviewComment()

One comment on the diff, outside a review. Sends `pull_request_review_comment`.

```ts title="TypeScript"
const reviewComment = await user.reviewComment("…", { pr, path: "…", line });
```

```python title="Python"
review_comment = await user.review_comment("…", pr=pr, path="…", line=line)
```

```rust title="Rust"
let review_comment = user.review_comment("…").pr(&pr).path("…").line(line).await?;
```

| Parameter | Type                | Required |            |
| --------- | ------------------- | -------- | ---------- |
| `body`    | `string`            | yes      | positional |
| `pr`      | `GitHubPullRequest` | yes      | option     |
| `path`    | `string`            | yes      | option     |
| `line`    | `number`            | yes      | option     |
| `side`    | `"LEFT" \| "RIGHT"` | no       | option     |

**Returns** [`GitHubReviewComment`](https://channelstack.dev/docs/reference/api/github#githubreviewcomment).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### reply()

Reply in a thread on the diff. Sends `pull_request_review_comment`.

```ts title="TypeScript"
const reviewComment = await user.reply("…", { comment });
```

```python title="Python"
review_comment = await user.reply("…", comment=comment)
```

```rust title="Rust"
let review_comment = user.reply("…").comment(&comment).await?;
```

| Parameter | Type                  | Required |            |
| --------- | --------------------- | -------- | ---------- |
| `body`    | `string`              | yes      | positional |
| `comment` | `GitHubReviewComment` | yes      | option     |

**Returns** [`GitHubReviewComment`](https://channelstack.dev/docs/reference/api/github#githubreviewcomment).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### resolve()

Resolve a thread on the diff. Sends `pull_request_review_thread`.

```ts title="TypeScript"
const delivery = await user.resolve({ comment });
```

```python title="Python"
delivery = await user.resolve(comment=comment)
```

```rust title="Rust"
let delivery = user.resolve().comment(&comment).await?;
```

| Parameter | Type                  | Required |        |
| --------- | --------------------- | -------- | ------ |
| `comment` | `GitHubReviewComment` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### unresolve()

Reopen a thread on the diff. Sends `pull_request_review_thread`.

```ts title="TypeScript"
const delivery = await user.unresolve({ comment });
```

```python title="Python"
delivery = await user.unresolve(comment=comment)
```

```rust title="Rust"
let delivery = user.unresolve().comment(&comment).await?;
```

| Parameter | Type                  | Required |        |
| --------- | --------------------- | -------- | ------ |
| `comment` | `GitHubReviewComment` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### requestReview()

Request a review from people or the App's bot. Sends `pull_request` (action `review_requested`) per reviewer.

```ts title="TypeScript"
const delivery = await user.requestReview(reviewers, { pr });
```

```python title="Python"
delivery = await user.request_review(reviewers, pr=pr)
```

```rust title="Rust"
let delivery = user.request_review(reviewers).pr(&pr).await?;
```

| Parameter   | Type                                                        | Required |            |
| ----------- | ----------------------------------------------------------- | -------- | ---------- |
| `reviewers` | `GitHubUser \| GitHubApp \| Array<GitHubUser \| GitHubApp>` | yes      | positional |
| `pr`        | `GitHubPullRequest`                                         | yes      | option     |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### markReady()

Mark a draft pull request as ready for review. Sends `pull_request` (action `ready_for_review`).

```ts title="TypeScript"
const delivery = await user.markReady({ pr });
```

```python title="Python"
delivery = await user.mark_ready(pr=pr)
```

```rust title="Rust"
let delivery = user.mark_ready().pr(&pr).await?;
```

| Parameter | Type                | Required |        |
| --------- | ------------------- | -------- | ------ |
| `pr`      | `GitHubPullRequest` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### merge()

Merge a pull request. Sends `push` for the base branch, then `pull_request` (action `closed`, merged).

```ts title="TypeScript"
const delivery = await user.merge({ pr });
```

```python title="Python"
delivery = await user.merge(pr=pr)
```

```rust title="Rust"
let delivery = user.merge().pr(&pr).await?;
```

| Parameter | Type                              | Required |        |
| --------- | --------------------------------- | -------- | ------ |
| `pr`      | `GitHubPullRequest`               | yes      | option |
| `method`  | `"merge" \| "squash" \| "rebase"` | no       | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden), [`not_allowed`](https://channelstack.dev/docs/reference/api/errors#not-allowed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### rerun()

Click "Re-run" on a check run. Sends `check_run` (action `rerequested`).

```ts title="TypeScript"
const delivery = await user.rerun({ checkRun });
```

```python title="Python"
delivery = await user.rerun(check_run=check_run)
```

```rust title="Rust"
let delivery = user.rerun().check_run(&check_run).await?;
```

| Parameter  | Python / Rust | Type             | Required |        |
| ---------- | ------------- | ---------------- | -------- | ------ |
| `checkRun` | `check_run`   | `GitHubCheckRun` | yes      | option |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: a person's Re-run is a click in GitHub's UI, and the API lets only the owning App rerequest.

### requestAction()

Click one of the buttons the App put on a check run. Sends `check_run` (action `requested_action`).

```ts title="TypeScript"
const delivery = await user.requestAction("…", { checkRun });
```

```python title="Python"
delivery = await user.request_action("…", check_run=check_run)
```

```rust title="Rust"
let delivery = user.request_action("…").check_run(&check_run).await?;
```

| Parameter    | Python / Rust | Type             | Required |            |
| ------------ | ------------- | ---------------- | -------- | ---------- |
| `identifier` | `identifier`  | `string`         | yes      | positional |
| `checkRun`   | `check_run`   | `GitHubCheckRun` | yes      | option     |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`forbidden`](https://channelstack.dev/docs/reference/api/errors#forbidden).

**Live:** needs the browser actor: GitHub sends this only when a person clicks in the UI. The browser actor doesn't do this yet ([#47](https://github.com/christian-bromann/channelstack/issues/47)), so for now the call is refused with [`action_requires`](https://channelstack.dev/docs/reference/api/errors#action-requires) and the test is skipped.

## GitHubRepo

Returned by [`GitHubFixture.createRepo()`](https://channelstack.dev/docs/reference/api/github#createrepo).

| Field           | Python / Rust    | Type      |
| --------------- | ---------------- | --------- |
| `id`            | `id`             | `string`  |
| `owner`         | `owner`          | `string`  |
| `name`          | `name`           | `string`  |
| `fullName`      | `full_name`      | `string`  |
| `defaultBranch` | `default_branch` | `string`  |
| `private`       | `private`        | `boolean` |

### installApp()

Install an App on this repository. Sends that App `installation_repositories`.

```ts title="TypeScript"
const delivery = await repo.installApp(app);
```

```python title="Python"
delivery = await repo.install_app(app)
```

```rust title="Rust"
let delivery = repo.install_app(&app).await?;
```

| Parameter | Type        | Required |            |
| --------- | ----------- | -------- | ---------- |
| `app`     | `GitHubApp` | yes      | positional |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### uninstallApp()

Take an App off this repository. Sends that App `installation_repositories`.

```ts title="TypeScript"
const delivery = await repo.uninstallApp(app);
```

```python title="Python"
delivery = await repo.uninstall_app(app)
```

```rust title="Rust"
let delivery = repo.uninstall_app(&app).await?;
```

| Parameter | Type        | Required |            |
| --------- | ----------- | -------- | ---------- |
| `app`     | `GitHubApp` | yes      | positional |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Errors** [`validation_failed`](https://channelstack.dev/docs/reference/api/errors#validation-failed).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### issue()

An issue of this repository by its number.

```ts title="TypeScript"
const issue = await repo.issue(number);
```

```python title="Python"
issue = await repo.issue(number)
```

```rust title="Rust"
let issue = repo.issue(number).await?;
```

| Parameter | Type     | Required |            |
| --------- | -------- | -------- | ---------- |
| `number`  | `number` | yes      | positional |

**Returns** [`GitHubIssue`](https://channelstack.dev/docs/reference/api/github#githubissue).

### pullRequest()

A pull request of this repository by its number.

```ts title="TypeScript"
const pullRequest = await repo.pullRequest(number);
```

```python title="Python"
pull_request = await repo.pull_request(number)
```

```rust title="Rust"
let pull_request = repo.pull_request(number).await?;
```

| Parameter | Type     | Required |            |
| --------- | -------- | -------- | ---------- |
| `number`  | `number` | yes      | positional |

**Returns** [`GitHubPullRequest`](https://channelstack.dev/docs/reference/api/github#githubpullrequest).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### readFile()

A file's text as it is on a branch (the default branch without `ref`), or nothing when it isn't there.

```ts title="TypeScript"
const result = await repo.readFile("…", { ref: "…" });
```

```python title="Python"
result = await repo.read_file("…", ref="…")
```

```rust title="Rust"
let result = repo.read_file("…").r#ref("…").await?;
```

| Parameter | Python / Rust   | Type     | Required |            |
| --------- | --------------- | -------- | -------- | ---------- |
| `path`    | `path`          | `string` | yes      | positional |
| `ref`     | `ref` · `r#ref` | `string` | no       | option     |

**Returns** `string | undefined`. It reads once the app is quiet.

### commits()

The commits of a branch (the default branch without `branch`), newest first.

```ts title="TypeScript"
const commits = await repo.commits({ branch: "…" });
```

```python title="Python"
commits = await repo.commits(branch="…")
```

```rust title="Rust"
let commits = repo.commits().branch("…").await?;
```

| Parameter | Type     | Required |        |
| --------- | -------- | -------- | ------ |
| `branch`  | `string` | no       | option |

**Returns** [`GitHubCommits`](https://channelstack.dev/docs/reference/api/github#githubcommits).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

## GitHubIssue

Returned by [`GitHubApp.openIssue()`](https://channelstack.dev/docs/reference/api/github#openissue), [`GitHubUser.openIssue()`](https://channelstack.dev/docs/reference/api/github#openissue-1), [`GitHubRepo.issue()`](https://channelstack.dev/docs/reference/api/github#issue), [`GitHubIssue.refresh()`](https://channelstack.dev/docs/reference/api/github#refresh).

| Field    | Python / Rust | Type                      |
| -------- | ------------- | ------------------------- |
| `repoId` | `repo_id`     | `string`                  |
| `number` | `number`      | `number`                  |
| `repo`   | `repo`        | `GitHubRepo`              |
| `url`    | `url`         | `string`                  |
| `author` | `author`      | `GitHubUser \| GitHubApp` |

### refresh()

Read the issue again.

```ts title="TypeScript"
const updated = await issue.refresh();
```

```python title="Python"
updated = await issue.refresh()
```

```rust title="Rust"
let updated = issue.refresh().await?;
```

**Returns** [`GitHubIssue`](https://channelstack.dev/docs/reference/api/github#githubissue).

### title()

The issue's title as it is now.

```ts title="TypeScript"
const result = await issue.title();
```

```python title="Python"
result = await issue.title()
```

```rust title="Rust"
let result = issue.title().await?;
```

**Returns** `string`.

### state()

Open or closed, once the agent is quiet.

```ts title="TypeScript"
const result = await issue.state();
```

```python title="Python"
result = await issue.state()
```

```rust title="Rust"
let result = issue.state().await?;
```

**Returns** `"open" | "closed"`. It reads once the app is quiet.

### labels()

The names of the labels on it.

```ts title="TypeScript"
const items = await issue.labels();
```

```python title="Python"
items = await issue.labels()
```

```rust title="Rust"
let items = issue.labels().await?;
```

**Returns** `string[]`.

### assignees()

Who it is assigned to.

```ts title="TypeScript"
const items = await issue.assignees();
```

```python title="Python"
items = await issue.assignees()
```

```rust title="Rust"
let items = issue.assignees().await?;
```

**Returns** `Array<GitHubUser | GitHubApp>`.

### comments()

The comments of the conversation, oldest first.

```ts title="TypeScript"
const comments = await issue.comments();
```

```python title="Python"
comments = await issue.comments()
```

```rust title="Rust"
let comments = issue.comments().await?;
```

**Returns** [`GitHubComments`](https://channelstack.dev/docs/reference/api/github#githubcomments).

### transcript()

The issue or pull request as a person reads it: description, comments, reviews and threads.

```ts title="TypeScript"
const transcript = await issue.transcript();
```

```python title="Python"
transcript = await issue.transcript()
```

```rust title="Rust"
let transcript = issue.transcript().await?;
```

**Returns** [`GitHubTranscript`](https://channelstack.dev/docs/reference/api/github#githubtranscript).

### waitForComment()

Waits for the next comment after the last one this handle returned: it polls `comments()` and never sleeps longer than it must.

```ts title="TypeScript"
const comment = await issue.waitForComment({ from: "my-agent" });
```

```python title="Python"
comment = await issue.wait_for_comment(from_="my-agent")
```

```rust title="Rust"
let comment = issue.wait_for_comment().from("my-agent").await?;
```

| Parameter | Python / Rust    | Type                                | Required |                      |
| --------- | ---------------- | ----------------------------------- | -------- | -------------------- |
| `from`    | `from_` · `from` | `GitHubUser \| GitHubApp \| string` | no       | a handle, or a name  |
| `body`    | `body`           | `string \| RegExp`                  | no       | contains, or matches |
| `timeout` | `timeout`        | `Duration`                          | no       | default 10s          |

**Returns** [`GitHubComment`](https://channelstack.dev/docs/reference/api/github#githubcomment). When the time is up, it fails with what it was waiting for.

### latestComment()

The latest comment, once the app is quiet. Waits for at least one: it polls `comments()` and never sleeps longer than it must.

```ts title="TypeScript"
const comment = await issue.latestComment({ from: "my-agent" });
```

```python title="Python"
comment = await issue.latest_comment(from_="my-agent")
```

```rust title="Rust"
let comment = issue.latest_comment().from("my-agent").await?;
```

| Parameter  | Python / Rust    | Type                                | Required |                     |
| ---------- | ---------------- | ----------------------------------- | -------- | ------------------- |
| `from`     | `from_` · `from` | `GitHubUser \| GitHubApp \| string` | no       | a handle, or a name |
| `timeout`  | `timeout`        | `Duration`                          | no       | default 10s         |
| `quietFor` | `quiet_for`      | `Duration`                          | no       | default 750ms       |

**Returns** [`GitHubComment`](https://channelstack.dev/docs/reference/api/github#githubcomment). When the time is up, it fails with what it was waiting for.

## GitHubDelivery

Returned by [`GitHubApp.editIssue()`](https://channelstack.dev/docs/reference/api/github#editissue), [`GitHubApp.close()`](https://channelstack.dev/docs/reference/api/github#close), [`GitHubApp.reopen()`](https://channelstack.dev/docs/reference/api/github#reopen), [`GitHubApp.edit()`](https://channelstack.dev/docs/reference/api/github#edit).

| Field      | Python / Rust     | Type                                                                      |
| ---------- | ----------------- | ------------------------------------------------------------------------- |
| `id`       | `id`              | `string`                                                                  |
| `channel`  | `channel`         | `"github"`                                                                |
| `app`      | `app`             | `string`                                                                  |
| `type`     | `type` · `r#type` | `string`                                                                  |
| `action`   | `action`          | `string \| undefined`                                                     |
| `guid`     | `guid`            | `string`                                                                  |
| `payload`  | `payload`         | `unknown \| undefined`                                                    |
| `attempts` | `attempts`        | `DeliveryAttempt[]`                                                       |
| `status`   | `status`          | `"pending" \| "acknowledged" \| "failed" \| "timed_out" \| "unreachable"` |

### refresh()

Re-read a delivery: its attempts and status.

```ts title="TypeScript"
const updated = await delivery.refresh();
```

```python title="Python"
updated = await delivery.refresh()
```

```rust title="Rust"
let updated = delivery.refresh().await?;
```

**Returns** [`GitHubDelivery`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

### redeliver()

Redeliver from the App's delivery log, as GitHub's UI and API do: the same GUID, a new attempt.

```ts title="TypeScript"
const deliveryAttempt = await delivery.redeliver();
```

```python title="Python"
delivery_attempt = await delivery.redeliver()
```

```rust title="Rust"
let delivery_attempt = delivery.redeliver().await?;
```

**Returns** [`DeliveryAttempt`](https://channelstack.dev/docs/reference/api/client#deliveryattempt).

### resend()

Send the delivery again, unchanged or signed with a secret that isn't the App's.

```ts title="TypeScript"
const deliveryAttempt = await delivery.resend({ badSignature });
```

```python title="Python"
delivery_attempt = await delivery.resend(bad_signature=bad_signature)
```

```rust title="Rust"
let delivery_attempt = delivery.resend().bad_signature(bad_signature).await?;
```

| Parameter      | Python / Rust   | Type      | Required |        |
| -------------- | --------------- | --------- | -------- | ------ |
| `badSignature` | `bad_signature` | `boolean` | no       | option |

**Returns** [`DeliveryAttempt`](https://channelstack.dev/docs/reference/api/client#deliveryattempt).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): Live, the platform delivers to the agent itself and channelstack isn't in the path (delivery chaos is fake-only).

### settled()

Waits for the delivery to settle: it polls `refresh()` and never sleeps longer than it must.

```ts title="TypeScript"
const updated = await delivery.settled();
```

```python title="Python"
updated = await delivery.settled()
```

```rust title="Rust"
let updated = delivery.settled().await?;
```

| Parameter | Type       | Required |             |
| --------- | ---------- | -------- | ----------- |
| `timeout` | `Duration` | no       | default 10s |

**Returns** [`GitHubDelivery`](https://channelstack.dev/docs/reference/api/github#githubdelivery). When the time is up, it fails with what it was waiting for.

## GitHubCommit

Returned by [`GitHubApp.push()`](https://channelstack.dev/docs/reference/api/github#push), [`GitHubUser.push()`](https://channelstack.dev/docs/reference/api/github#push-1), [`GitHubPullRequest.headCommit()`](https://channelstack.dev/docs/reference/api/github#headcommit).

| Field         | Python / Rust  | Type                                   |
| ------------- | -------------- | -------------------------------------- |
| `repoId`      | `repo_id`      | `string`                               |
| `sha`         | `sha`          | `string`                               |
| `message`     | `message`      | `string`                               |
| `author`      | `author`       | `GitHubUser \| GitHubApp \| undefined` |
| `branch`      | `branch`       | `string`                               |
| `committedAt` | `committed_at` | `string`                               |

### checkRuns()

The check runs on this commit: the newest of each name.

```ts title="TypeScript"
const checkRuns = await commit.checkRuns();
```

```python title="Python"
check_runs = await commit.check_runs()
```

```rust title="Rust"
let check_runs = commit.check_runs().await?;
```

**Returns** [`GitHubCheckRuns`](https://channelstack.dev/docs/reference/api/github#githubcheckruns).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### statuses()

The commit statuses on this commit: the newest of each context.

```ts title="TypeScript"
const statuses = await commit.statuses();
```

```python title="Python"
statuses = await commit.statuses()
```

```rust title="Rust"
let statuses = commit.statuses().await?;
```

**Returns** [`GitHubStatuses`](https://channelstack.dev/docs/reference/api/github#githubstatuses).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

## GitHubCheckRun

| Field         | Python / Rust | Type                                                                                                                      |
| ------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `id`          | `id`          | `number`                                                                                                                  |
| `name`        | `name`        | `string`                                                                                                                  |
| `app`         | `app`         | `{ slug: string }`                                                                                                        |
| `headSha`     | `head_sha`    | `string`                                                                                                                  |
| `status`      | `status`      | `"queued" \| "in_progress" \| "completed"`                                                                                |
| `conclusion`  | `conclusion`  | `"success" \| "failure" \| "neutral" \| "cancelled" \| "skipped" \| "timed_out" \| "action_required" \| undefined`        |
| `title`       | `title`       | `string \| undefined`                                                                                                     |
| `summary`     | `summary`     | `string \| undefined`                                                                                                     |
| `annotations` | `annotations` | `Array<{ path: string; startLine: number; endLine: number; level: "notice" \| "warning" \| "failure"; message: string }>` |
| `actions`     | `actions`     | `string[]`                                                                                                                |

## GitHubComment

Returned by [`GitHubApp.comment()`](https://channelstack.dev/docs/reference/api/github#comment), [`GitHubUser.comment()`](https://channelstack.dev/docs/reference/api/github#comment-1), [`GitHubComment.refresh()`](https://channelstack.dev/docs/reference/api/github#refresh-2).

| Field       | Python / Rust | Type                          |
| ----------- | ------------- | ----------------------------- |
| `id`        | `id`          | `number`                      |
| `url`       | `url`         | `string`                      |
| `issue`     | `issue`       | `GitHubIssue`                 |
| `author`    | `author`      | `GitHubUser \| GitHubApp`     |
| `body`      | `body`        | `string`                      |
| `createdAt` | `created_at`  | `string`                      |
| `delivery`  | `delivery`    | `GitHubDelivery \| undefined` |

### refresh()

Read a conversation comment again.

```ts title="TypeScript"
const updated = await comment.refresh();
```

```python title="Python"
updated = await comment.refresh()
```

```rust title="Rust"
let updated = comment.refresh().await?;
```

**Returns** [`GitHubComment`](https://channelstack.dev/docs/reference/api/github#githubcomment).

### reactions()

The reactions on a conversation comment, by content.

```ts title="TypeScript"
const reactions = await comment.reactions();
```

```python title="Python"
reactions = await comment.reactions()
```

```rust title="Rust"
let reactions = comment.reactions().await?;
```

**Returns** [`GitHubReactions`](https://channelstack.dev/docs/reference/api/github#githubreactions).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### deliveryFor()

The `issue_comment` (`created`) delivery this comment caused to this App (decision 0027), or nothing when it wasn't told. The comment's `delivery` is the built-in App's.

```ts title="TypeScript"
const delivery = await comment.deliveryFor(app);
```

```python title="Python"
delivery = await comment.delivery_for(app)
```

```rust title="Rust"
let delivery = comment.delivery_for(&app).await?;
```

| Parameter | Type        | Required |            |
| --------- | ----------- | -------- | ---------- |
| `app`     | `GitHubApp` | yes      | positional |

**Returns** [`GitHubDelivery | undefined`](https://channelstack.dev/docs/reference/api/github#githubdelivery).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: live, the org holds only the App channelstack has credentials for.

## GitHubReviewComment

Returned by [`GitHubApp.reviewComment()`](https://channelstack.dev/docs/reference/api/github#reviewcomment), [`GitHubApp.reply()`](https://channelstack.dev/docs/reference/api/github#reply), [`GitHubUser.reviewComment()`](https://channelstack.dev/docs/reference/api/github#reviewcomment-1), [`GitHubUser.reply()`](https://channelstack.dev/docs/reference/api/github#reply-1).

| Field      | Type                          |
| ---------- | ----------------------------- |
| `id`       | `number`                      |
| `pr`       | `GitHubPullRequest`           |
| `author`   | `GitHubUser \| GitHubApp`     |
| `path`     | `string`                      |
| `line`     | `number`                      |
| `side`     | `"LEFT" \| "RIGHT"`           |
| `body`     | `string`                      |
| `delivery` | `GitHubDelivery \| undefined` |

### replies()

The replies in this comment's thread, once the agent is quiet.

```ts title="TypeScript"
const reviewCommentReplies = await reviewComment.replies();
```

```python title="Python"
review_comment_replies = await review_comment.replies()
```

```rust title="Rust"
let review_comment_replies = review_comment.replies().await?;
```

**Returns** [`GitHubReviewCommentReplies`](https://channelstack.dev/docs/reference/api/github#githubreviewcommentreplies). It reads once the app is quiet.

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### resolved()

Is this comment's thread resolved?.

```ts title="TypeScript"
const result = await reviewComment.resolved();
```

```python title="Python"
result = await review_comment.resolved()
```

```rust title="Rust"
let result = review_comment.resolved().await?;
```

**Returns** `boolean`.

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### transcript()

This comment's thread as a person reads it.

```ts title="TypeScript"
const transcript = await reviewComment.transcript();
```

```python title="Python"
transcript = await review_comment.transcript()
```

```rust title="Rust"
let transcript = review_comment.transcript().await?;
```

**Returns** [`GitHubTranscript`](https://channelstack.dev/docs/reference/api/github#githubtranscript).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

## GitHubPullRequest

A kind of [`GitHubIssue`](https://channelstack.dev/docs/reference/api/github#githubissue): it has all its fields and methods.

Returned by [`GitHubApp.openPullRequest()`](https://channelstack.dev/docs/reference/api/github#openpullrequest), [`GitHubUser.openPullRequest()`](https://channelstack.dev/docs/reference/api/github#openpullrequest-1), [`GitHubRepo.pullRequest()`](https://channelstack.dev/docs/reference/api/github#pullrequest), [`GitHubPullRequest.refresh()`](https://channelstack.dev/docs/reference/api/github#refresh-3).

| Field    | Python / Rust | Type                      |
| -------- | ------------- | ------------------------- |
| `repoId` | `repo_id`     | `string`                  |
| `number` | `number`      | `number`                  |
| `repo`   | `repo`        | `GitHubRepo`              |
| `url`    | `url`         | `string`                  |
| `author` | `author`      | `GitHubUser \| GitHubApp` |
| `head`   | `head`        | `string`                  |
| `base`   | `base`        | `string`                  |

### refresh()

Read the pull request again.

```ts title="TypeScript"
const updated = await pullRequest.refresh();
```

```python title="Python"
updated = await pull_request.refresh()
```

```rust title="Rust"
let updated = pull_request.refresh().await?;
```

**Returns** [`GitHubPullRequest`](https://channelstack.dev/docs/reference/api/github#githubpullrequest).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### headCommit()

The newest commit of the pull request's branch, once the agent is quiet.

```ts title="TypeScript"
const commit = await pullRequest.headCommit();
```

```python title="Python"
commit = await pull_request.head_commit()
```

```rust title="Rust"
let commit = pull_request.head_commit().await?;
```

**Returns** [`GitHubCommit`](https://channelstack.dev/docs/reference/api/github#githubcommit). It reads once the app is quiet.

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### reviews()

The submitted reviews, oldest first.

```ts title="TypeScript"
const reviews = await pullRequest.reviews();
```

```python title="Python"
reviews = await pull_request.reviews()
```

```rust title="Rust"
let reviews = pull_request.reviews().await?;
```

**Returns** [`GitHubReviews`](https://channelstack.dev/docs/reference/api/github#githubreviews).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### reviewComments()

The comments on the diff, oldest first.

```ts title="TypeScript"
const reviewComments = await pullRequest.reviewComments();
```

```python title="Python"
review_comments = await pull_request.review_comments()
```

```rust title="Rust"
let review_comments = pull_request.review_comments().await?;
```

**Returns** [`GitHubReviewComments`](https://channelstack.dev/docs/reference/api/github#githubreviewcomments).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### checkRuns()

The check runs on the pull request's newest commit: the newest of each name.

```ts title="TypeScript"
const pullCheckRuns = await pullRequest.checkRuns();
```

```python title="Python"
pull_check_runs = await pull_request.check_runs()
```

```rust title="Rust"
let pull_check_runs = pull_request.check_runs().await?;
```

**Returns** [`GitHubPullCheckRuns`](https://channelstack.dev/docs/reference/api/github#githubpullcheckruns).

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

### merged()

Has the pull request been merged?.

```ts title="TypeScript"
const result = await pullRequest.merged();
```

```python title="Python"
result = await pull_request.merged()
```

```rust title="Rust"
let result = pull_request.merged().await?;
```

**Returns** `boolean`.

**Live:** refused with [`unsupported_in_live`](https://channelstack.dev/docs/reference/api/errors#unsupported-in-live): not yet: pull requests, reviews, pushes, checks and installs aren't built live.

## Types

Plain values the handles return and take.

### GitHubUsers

```ts
type GitHubUsers = GitHubUser[];
```

### GitHubRepos

```ts
type GitHubRepos = GitHubRepo[];
```

### GitHubIssues

```ts
type GitHubIssues = GitHubIssueListing[];
```

### GitHubIssueListing

| Field         | Python / Rust  | Type          |
| ------------- | -------------- | ------------- |
| `issue`       | `issue`        | `GitHubIssue` |
| `title`       | `title`        | `string`      |
| `pullRequest` | `pull_request` | `boolean`     |

### GitHubApps

```ts
type GitHubApps = GitHubApp[];
```

### GitHubCommits

```ts
type GitHubCommits = GitHubCommit[];
```

### GitHubCheckRuns

```ts
type GitHubCheckRuns = GitHubCheckRun[];
```

### GitHubStatuses

```ts
type GitHubStatuses = Array<{ context: string; state: "pending" | "success" | "failure" | "error"; author: GitHubUser | GitHubApp }>;
```

### GitHubLabelDeliveries

```ts
type GitHubLabelDeliveries = GitHubDelivery[];
```

### GitHubUnlabelDeliveries

```ts
type GitHubUnlabelDeliveries = GitHubDelivery[];
```

### GitHubAssignDeliveries

```ts
type GitHubAssignDeliveries = GitHubDelivery[];
```

### GitHubReview

| Field      | Type                                                                           |
| ---------- | ------------------------------------------------------------------------------ |
| `id`       | `number`                                                                       |
| `author`   | `GitHubUser \| GitHubApp`                                                      |
| `state`    | `"COMMENTED" \| "APPROVED" \| "CHANGES_REQUESTED" \| "DISMISSED" \| "PENDING"` |
| `body`     | `string`                                                                       |
| `comments` | `GitHubReviewComment[]`                                                        |
| `delivery` | `GitHubDelivery \| undefined`                                                  |

### GitHubComments

```ts
type GitHubComments = GitHubComment[];
```

### GitHubTranscript

| Field     | Type                      |
| --------- | ------------------------- |
| `entries` | `GitHubTranscriptEntry[]` |
| `text`    | `string`                  |

### GitHubTranscriptEntry

| Field      | Type              |
| ---------- | ----------------- |
| `id`       | `string`          |
| `author`   | `GitHubPrincipal` |
| `at`       | `string`          |
| `text`     | `string`          |
| `controls` | `string[]`        |
| `edited`   | `boolean`         |
| `depth`    | `number`          |

### GitHubPrincipal

| Field  | Type              |
| ------ | ----------------- |
| `id`   | `string`          |
| `name` | `string`          |
| `kind` | `"user" \| "app"` |

### GitHubReviews

```ts
type GitHubReviews = GitHubReview[];
```

### GitHubReviewComments

```ts
type GitHubReviewComments = GitHubReviewComment[];
```

### GitHubPullCheckRuns

```ts
type GitHubPullCheckRuns = GitHubCheckRun[];
```

### GitHubReactions

```ts
type GitHubReactions = GitHubReaction[];
```

### GitHubReaction

| Field     | Type                                                                                 |
| --------- | ------------------------------------------------------------------------------------ |
| `content` | `"+1" \| "-1" \| "laugh" \| "confused" \| "heart" \| "hooray" \| "rocket" \| "eyes"` |
| `by`      | `Array<GitHubUser \| GitHubApp>`                                                     |

### GitHubReviewCommentReplies

```ts
type GitHubReviewCommentReplies = GitHubReviewComment[];
```

### GitHubDeliveries

```ts
type GitHubDeliveries = GitHubDelivery[];
```

### GitHubApiCalls

```ts
type GitHubApiCalls = GitHubApiCall[];
```

### GitHubApiCall

| Field            | Python / Rust     | Type                   |
| ---------------- | ----------------- | ---------------------- |
| `id`             | `id`              | `string`               |
| `channel`        | `channel`         | `"github"`             |
| `operation`      | `operation`       | `string`               |
| `method`         | `method`          | `string`               |
| `path`           | `path`            | `string`               |
| `at`             | `at`              | `string`               |
| `durationMs`     | `duration_ms`     | `number`               |
| `request`        | `request`         | `unknown \| undefined` |
| `responseStatus` | `response_status` | `number`               |
| `response`       | `response`        | `unknown \| undefined` |
| `error`          | `error`           | `string \| undefined`  |

### GitHubAppCalls

```ts
type GitHubAppCalls = GitHubApiCall[];
```
