---
title: "Repositories"
description: "Repositories, files, releases, accounts, teams and search."
canonical_url: "https://forges.link/reference/repositories"
---
# Repositories

> Repositories, files, releases, accounts, teams and search.

For an operation that the forge lacks, see [Unsupported operations](https://forges.link/reference/provider#unsupported-operations).

## `provider.repos`

Repositories, and the labels, milestones and collaborators that belong to them.

### `repos.get()`

Reads a repository by its ref. Rejects with `NotFoundError` when it does not exist or the credential cannot see
it.

**Capability:** `repos.get`.

```ts
repos.get(ref: RepoRef, options?: RepoGetOptions): Promise<Repo>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ref
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#repogetoptions">
        <code>
          RepoGetOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<Repo>`](https://forges.link/reference/data-model#repo)

<api-explorer verb="repos.get">



</api-explorer>

### `repos.list()`

The authenticated account's repositories, or the installation's under app auth.

**Capability:** `repos.list`. Anonymous providers reject it.

```ts
repos.list(options?: RepoQuery): ForgeIterable<Repo>
repos.listPage(options?: RepoQuery): Promise<Page<Repo>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#repoquery">
        <code>
          RepoQuery
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `repos.list()`: [`ForgeIterable<Repo>`](https://forges.link/reference/data-model#repo)
- `repos.listPage()`: [`Promise<Page<Repo>>`](https://forges.link/reference/data-model#repo)

<api-explorer verb="repos.list">



</api-explorer>

### `repos.byOwner()`

The repositories of a user, organisation, group, workspace or project that the credential can see.

**Capability:** `repos.byOwner`.

```ts
repos.byOwner(owner: RepoRef, query?: OwnerRepoQuery): ForgeIterable<Repo>
repos.byOwnerPage(owner: RepoRef, query?: OwnerRepoQuery): Promise<Page<Repo>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        owner
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
    
    <td>
      A namespace ref, such as <code>
        { forge, instance, owner: 'acme', name: '', kind: 'namespace' }
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        query?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#ownerrepoquery">
        <code>
          OwnerRepoQuery
        </code>
      </a>
    </td>
    
    <td>
      
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `repos.byOwner()`: [`ForgeIterable<Repo>`](https://forges.link/reference/data-model#repo)
- `repos.byOwnerPage()`: [`Promise<Page<Repo>>`](https://forges.link/reference/data-model#repo)

<api-explorer verb="repos.byOwner">



</api-explorer>

### `repos.labels()`

Every label defined on the repository, whether or not a thread carries it.

**Capability:** `repos.labels`.

```ts
repos.labels(repo: RepoRef, options?: PageOptions): ForgeIterable<Label>
repos.labelsPage(repo: RepoRef, options?: PageOptions): Promise<Page<Label>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `repos.labels()`: [`ForgeIterable<Label>`](https://forges.link/reference/data-model#label)
- `repos.labelsPage()`: [`Promise<Page<Label>>`](https://forges.link/reference/data-model#label)

<api-explorer verb="repos.labels">



</api-explorer>

### `repos.createLabel()`

Creates a label in a repository. A repeat rejects on most forges, because the name is taken.

**Capability:** `repos.createLabel`. Read-only and anonymous providers reject it.

```ts
repos.createLabel(repo: RepoRef, label: LabelInput, options?: BaseOptions): Promise<Label>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        label
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#labelinput">
        <code>
          LabelInput
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<Label>`](https://forges.link/reference/data-model#label)

<api-explorer verb="repos.createLabel">



</api-explorer>

### `repos.milestones()`

Lists the milestones of a repository.

**Capability:** `repos.milestones`.

```ts
repos.milestones(repo: RepoRef, options?: MilestoneListOptions): ForgeIterable<Milestone>
repos.milestonesPage(repo: RepoRef, options?: MilestoneListOptions): Promise<Page<Milestone>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#milestonelistoptions">
        <code>
          MilestoneListOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `repos.milestones()`: [`ForgeIterable<Milestone>`](https://forges.link/reference/data-model#milestone)
- `repos.milestonesPage()`: [`Promise<Page<Milestone>>`](https://forges.link/reference/data-model#milestone)

<api-explorer verb="repos.milestones">



</api-explorer>

### `repos.collaborators()`

Lists the collaborators of a repository, with their roles.

**Capability:** `repos.collaborators`.

```ts
repos.collaborators(repo: RepoRef, options?: PageOptions): ForgeIterable<Collaborator>
repos.collaboratorsPage(repo: RepoRef, options?: PageOptions): Promise<Page<Collaborator>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `repos.collaborators()`: [`ForgeIterable<Collaborator>`](https://forges.link/reference/data-model#collaborator)
- `repos.collaboratorsPage()`: [`Promise<Page<Collaborator>>`](https://forges.link/reference/data-model#collaborator)

<api-explorer verb="repos.collaborators">



</api-explorer>

### `repos.contributors()`

Lists the commit authors of a repository with their commit counts, most commits first.

**Capability:** `repos.contributors`.

```ts
repos.contributors(repo: RepoRef, options?: PageOptions): ForgeIterable<Contributor>
repos.contributorsPage(repo: RepoRef, options?: PageOptions): Promise<Page<Contributor>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `repos.contributors()`: [`ForgeIterable<Contributor>`](https://forges.link/reference/data-model#contributor)
- `repos.contributorsPage()`: [`Promise<Page<Contributor>>`](https://forges.link/reference/data-model#contributor)

<api-explorer verb="repos.contributors">



</api-explorer>

### `repos.contributorStats()`

Weekly commit activity of each contributor to a repository. Where the forge computes the statistics in the
background, the provider waits for them, and throws a `ForgeApiError` with status `202` if they are still not ready.

**Capability:** `repos.contributorStats`.

```ts
repos.contributorStats(repo: RepoRef, options?: BaseOptions): Promise<ContributorStats[]>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<ContributorStats[]>`](https://forges.link/reference/data-model#contributorstats)

<api-explorer verb="repos.contributorStats">



</api-explorer>

### `repos.templates()`

The issue and pull request templates a repository offers, ready to fill in before `threads.create()`. On GitHub,
a repository without its own falls back to the owner's `.github` repository, same as the web UI.

**Example**

```ts
const [template] = await provider.repos.templates(repo, { kind: 'pull_request' })
const body = template?.body ?? ''
```

**Capability:** `repos.templates`.

```ts
repos.templates(repo: RepoRef, options?: RepoTemplateOptions): Promise<RepoTemplate[]>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#repotemplateoptions">
        <code>
          RepoTemplateOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<RepoTemplate[]>`](https://forges.link/reference/data-model#repotemplate)

<api-explorer verb="repos.templates">



</api-explorer>

### `repos.permissionFor()`

One account's role on the repository; `'none'` when it has no access.

**Capability:** `repos.permissionFor`.

```ts
repos.permissionFor(repo: RepoRef, actor: string | Actor, options?: BaseOptions): Promise<RepoRole>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        actor
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#actor">
        <code>
          string | Actor
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<RepoRole>`](https://forges.link/reference/data-model#reporole)

<api-explorer verb="repos.permissionFor">



</api-explorer>

### `repos.addCollaborator()`

Gives an account a role on a repository, or invites it where the forge asks the account to accept first. A repeat
can reject where the forge refuses to add an existing member (GitLab).

**Capability:** `repos.addCollaborator`. Read-only and anonymous providers reject it.

```ts
repos.addCollaborator(repo: RepoRef, actor: string | Actor, role: RepoRole, options?: BaseOptions): Promise<AddCollaboratorResult>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        actor
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#actor">
        <code>
          string | Actor
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        role
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporole">
        <code>
          RepoRole
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<AddCollaboratorResult>`](https://forges.link/reference/data-model#addcollaboratorresult)

<api-explorer verb="repos.addCollaborator">



</api-explorer>

### `repos.assignableUsers()`

Accounts that can be assigned to a thread in the repository.

**Capability:** `repos.assignableUsers`.

```ts
repos.assignableUsers(repo: RepoRef, options?: PageOptions): ForgeIterable<Actor>
repos.assignableUsersPage(repo: RepoRef, options?: PageOptions): Promise<Page<Actor>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `repos.assignableUsers()`: [`ForgeIterable<Actor>`](https://forges.link/reference/data-model#actor)
- `repos.assignableUsersPage()`: [`Promise<Page<Actor>>`](https://forges.link/reference/data-model#actor)

<api-explorer verb="repos.assignableUsers">



</api-explorer>

### `repos.reviewerCandidates()`

Accounts that can be asked to review a given pull request.

**Capability:** `repos.reviewerCandidates`.

```ts
repos.reviewerCandidates(ref: ThreadRef, options?: PageOptions): ForgeIterable<Actor>
repos.reviewerCandidatesPage(ref: ThreadRef, options?: PageOptions): Promise<Page<Actor>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ref
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#threadref">
        <code>
          ThreadRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `repos.reviewerCandidates()`: [`ForgeIterable<Actor>`](https://forges.link/reference/data-model#actor)
- `repos.reviewerCandidatesPage()`: [`Promise<Page<Actor>>`](https://forges.link/reference/data-model#actor)

<api-explorer verb="repos.reviewerCandidates">



</api-explorer>

### `repos.events()`

Lists the activity feed of a repository: pushes, new branches and tags, and changes to its threads and releases.
Events come in the order the forge added them to the feed, latest first, which can differ from `occurredAt`
where the forge adds events late. Each event has `source: 'poll'`.

**Capability:** `repos.events`.

```ts
repos.events(repo: RepoRef, options?: EventFeedOptions): ForgeIterable<ForgeEvent>
repos.eventsPage(repo: RepoRef, options?: EventFeedOptions): Promise<Page<ForgeEvent>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#eventfeedoptions">
        <code>
          EventFeedOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `repos.events()`: [`ForgeIterable<ForgeEvent>`](https://forges.link/reference/data-model#forgeevent)
- `repos.eventsPage()`: [`Promise<Page<ForgeEvent>>`](https://forges.link/reference/data-model#forgeevent)

<api-explorer verb="repos.events">



</api-explorer>

## `provider.contents`

Files, trees, branches, tags and commits of a repository.

### `contents.file()`

One file's contents. Binary-safe: `content` is a `Uint8Array` unless the
forge reports text and `as: 'text'` was asked for. Files past the forge's
inline limit (1 MB on GitHub) are read from the raw or blob endpoint
instead of failing.

**Example**

```ts
const file = await provider.contents.file(repo, 'package.json', { as: 'text' })
const manifest = JSON.parse(file.content as string)
```

**Capability:** `contents.file`.

```ts
contents.file(repo: RepoRef, path: string, options?: FileOptions): Promise<FileContent>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
    
    <td>
      The repository to read from.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        path
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The path of the file from the repository root.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#fileoptions">
        <code>
          FileOptions
        </code>
      </a>
    </td>
    
    <td>
      The revision to read, and whether to decode the content as text.
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<FileContent>`](https://forges.link/reference/data-model#filecontent)

<api-explorer verb="contents.file">



</api-explorer>

### `contents.tree()`

One level, or every descendant with `recursive`. Truncated listings carry a `tree_truncated` warning.

**Capability:** `contents.tree`.

```ts
contents.tree(repo: RepoRef, options?: TreeOptions): ForgeIterable<TreeEntry>
contents.treePage(repo: RepoRef, options?: TreeOptions): Promise<Page<TreeEntry>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#treeoptions">
        <code>
          TreeOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `contents.tree()`: [`ForgeIterable<TreeEntry>`](https://forges.link/reference/data-model#treeentry)
- `contents.treePage()`: [`Promise<Page<TreeEntry>>`](https://forges.link/reference/data-model#treeentry)

<api-explorer verb="contents.tree">



</api-explorer>

### `contents.branches()`

Lists the branches of a repository.

**Capability:** `contents.branches`.

```ts
contents.branches(repo: RepoRef, options?: PageOptions): ForgeIterable<Branch>
contents.branchesPage(repo: RepoRef, options?: PageOptions): Promise<Page<Branch>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `contents.branches()`: [`ForgeIterable<Branch>`](https://forges.link/reference/data-model#branch)
- `contents.branchesPage()`: [`Promise<Page<Branch>>`](https://forges.link/reference/data-model#branch)

<api-explorer verb="contents.branches">



</api-explorer>

### `contents.tags()`

Lists the tags of a repository.

**Capability:** `contents.tags`.

```ts
contents.tags(repo: RepoRef, options?: PageOptions): ForgeIterable<Tag>
contents.tagsPage(repo: RepoRef, options?: PageOptions): Promise<Page<Tag>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `contents.tags()`: [`ForgeIterable<Tag>`](https://forges.link/reference/data-model#tag)
- `contents.tagsPage()`: [`Promise<Page<Tag>>`](https://forges.link/reference/data-model#tag)

<api-explorer verb="contents.tags">



</api-explorer>

### `contents.resolveRef()`

Resolves a branch, tag or sha to a full commit sha; a full sha is returned as is.

**Capability:** `contents.resolveRef`.

```ts
contents.resolveRef(repo: RepoRef, ref: string, options?: BaseOptions): Promise<string>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ref
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** `Promise<string>`

<api-explorer verb="contents.resolveRef">



</api-explorer>

### `contents.commits()`

Lists the commits that lead to `ref`, or to the default branch.

**Capability:** `contents.commits`.

```ts
contents.commits(repo: RepoRef, query?: CommitQuery): ForgeIterable<Commit>
contents.commitsPage(repo: RepoRef, query?: CommitQuery): Promise<Page<Commit>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        query?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#commitquery">
        <code>
          CommitQuery
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `contents.commits()`: [`ForgeIterable<Commit>`](https://forges.link/reference/data-model#commit)
- `contents.commitsPage()`: [`Promise<Page<Commit>>`](https://forges.link/reference/data-model#commit)

<api-explorer verb="contents.commits">



</api-explorer>

### `contents.commit()`

One commit, with its files and stats.

**Capability:** `contents.commit`.

```ts
contents.commit(repo: RepoRef, sha: string, options?: BaseOptions): Promise<Commit>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        sha
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<Commit>`](https://forges.link/reference/data-model#commit)

<api-explorer verb="contents.commit">



</api-explorer>

### `contents.compare()`

Commits and files between two refs.

**Capability:** `contents.compare`.

```ts
contents.compare(repo: RepoRef, base: string, head: string, options?: CompareOptions): Promise<Comparison>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        base
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        head
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#compareoptions">
        <code>
          CompareOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<Comparison>`](https://forges.link/reference/data-model#comparison)

<api-explorer verb="contents.compare">



</api-explorer>

### `contents.commitFiles()`

Writes and deletes files in one commit on a branch, and moves the branch to it. A repeat with `expectedHead` or
`createFrom` rejects once the first attempt has moved or created the branch; without them, it adds a second commit.

**Example**

```ts
const commit = await provider.contents.commitFiles(repo, {
  branch: 'docs/readme',
  createFrom: 'main',
  message: 'docs: update readme',
  changes: [
    { path: 'README.md', content: '# widgets\n' },
    { path: 'OLD.md', content: null },
  ],
})
```

**Capability:** `contents.commitFiles`. Read-only and anonymous providers reject it.

```ts
contents.commitFiles(repo: RepoRef, input: CommitFilesInput, options?: BaseOptions): Promise<Commit>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
    
    <td>
      The repository to commit to.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        input
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#commitfilesinput">
        <code>
          CommitFilesInput
        </code>
      </a>
    </td>
    
    <td>
      The branch, the message and the files, with the head the branch must have and the ref to create it from.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
    
    <td>
      
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<Commit>`](https://forges.link/reference/data-model#commit)

**Throws:**

- `BranchMovedError` when the branch no longer points at `expectedHead`.
- `NotFoundError` when a file to delete does not exist.

<api-explorer verb="contents.commitFiles">



</api-explorer>

## `provider.releases`

Reading, creating and updating the releases of a repository, and downloading their assets.

### `releases.list()`

Lists the releases of a repository, including drafts and pre-releases where the credential can see them.

**Capability:** `releases.list`.

```ts
releases.list(repo: RepoRef, options?: PageOptions): ForgeIterable<Release>
releases.listPage(repo: RepoRef, options?: PageOptions): Promise<Page<Release>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `releases.list()`: [`ForgeIterable<Release>`](https://forges.link/reference/data-model#release)
- `releases.listPage()`: [`Promise<Page<Release>>`](https://forges.link/reference/data-model#release)

<api-explorer verb="releases.list">



</api-explorer>

### `releases.get()`

Reads a release by its ref.

**Capability:** `releases.get`.

```ts
releases.get(ref: ReleaseRef, options?: BaseOptions): Promise<Release>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ref
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#releaseref">
        <code>
          ReleaseRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<Release>`](https://forges.link/reference/data-model#release)

<api-explorer verb="releases.get">



</api-explorer>

### `releases.getByTag()`

The release for a tag name.

**Capability:** `releases.getByTag`.

```ts
releases.getByTag(repo: RepoRef, tag: string, options?: BaseOptions): Promise<Release>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        tag
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<Release>`](https://forges.link/reference/data-model#release)

<api-explorer verb="releases.getByTag">



</api-explorer>

### `releases.downloadAsset()`

Downloads a release asset, as a stream of its bytes, a `Uint8Array` with `as: 'binary'` or a string with
`as: 'text'`. A redirect to a CDN host is followed without the `Authorization` header, which those hosts reject.

**Example**

```ts
const release = await provider.releases.getByTag(repo, 'v1.0.0')
const asset = release.assets?.find(asset => asset.name.endsWith('.pdf'))
if (asset?.ref) {
  const bytes = await provider.releases.downloadAsset(asset.ref, { as: 'binary' })
}
```

**Capability:** `releases.downloadAsset`.

**Overload 1 of 3**

```ts
releases.downloadAsset(ref: ReleaseAssetRef, options?: DownloadAssetOptions & { as?: 'stream' }): Promise<ReadableStream<Uint8Array>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ref
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#releaseassetref">
        <code>
          ReleaseAssetRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#downloadassetoptions">
        <code>
          DownloadAssetOptions & { as?: 'stream' }
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** `Promise<ReadableStream<Uint8Array>>`

**Overload 2 of 3**

```ts
releases.downloadAsset(ref: ReleaseAssetRef, options: DownloadAssetOptions & { as: 'binary' }): Promise<Uint8Array>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ref
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#releaseassetref">
        <code>
          ReleaseAssetRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#downloadassetoptions">
        <code>
          DownloadAssetOptions & { as: 'binary' }
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** `Promise<Uint8Array>`

**Overload 3 of 3**

```ts
releases.downloadAsset(ref: ReleaseAssetRef, options: DownloadAssetOptions & { as: 'text' }): Promise<string>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ref
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#releaseassetref">
        <code>
          ReleaseAssetRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#downloadassetoptions">
        <code>
          DownloadAssetOptions & { as: 'text' }
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** `Promise<string>`

<api-explorer verb="releases.downloadAsset">



</api-explorer>

### `releases.latest()`

The most recent published release that is not a draft or prerelease, if any.

**Capability:** `releases.latest`.

```ts
releases.latest(repo: RepoRef, options?: BaseOptions): Promise<Release | undefined>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<Release | undefined>`](https://forges.link/reference/data-model#release)

<api-explorer verb="releases.latest">



</api-explorer>

### `releases.create()`

Creates a release, and its tag from `target` when the tag does not exist yet. A repeat for the same tag rejects on
forges that hold one release per tag; read it back with `getByTag()`.

**Example**

```ts
const release = await provider.releases.create(repo, { tag: 'v1.2.0', body: notes, draft: true })
```

**Capability:** `releases.create`. Read-only and anonymous providers reject it.

```ts
releases.create(repo: RepoRef, input: ReleaseInput, options?: BaseOptions): Promise<Release>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        repo
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
    
    <td>
      The repository to release.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        input
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#releaseinput">
        <code>
          ReleaseInput
        </code>
      </a>
    </td>
    
    <td>
      The tag, the name, the notes and whether the release is a draft or a prerelease.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
    
    <td>
      
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<Release>`](https://forges.link/reference/data-model#release)

**Throws:**

- `UnsupportedOperationError` for `draft: true` or `prerelease: true` on a forge without drafts or prereleases.

### `releases.update()`

Changes a release. Fields left out stay as they are, so `{ draft: false }` publishes a draft.

**Capability:** `releases.update`. Read-only and anonymous providers reject it.

```ts
releases.update(ref: ReleaseRef, update: ReleaseUpdate, options?: BaseOptions): Promise<Release>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ref
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#releaseref">
        <code>
          ReleaseRef
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        update
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#releaseupdate">
        <code>
          ReleaseUpdate
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<Release>`](https://forges.link/reference/data-model#release)

**Throws:**

- `UnsupportedOperationError` for a change the forge cannot make, such as a new tag on GitLab.
- `ForbiddenError` with reason `immutable_release` when the forge refuses the write because the
release is immutable (GitHub); its name, notes, prerelease and `latest` flags stay editable.

## `provider.users`

Reading accounts.

### `users.get()`

Reads an account by login, without needing a credential where the forge allows it.

**Capability:** `users.get`.

```ts
users.get(login: string, options?: BaseOptions): Promise<User>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        login
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<User>`](https://forges.link/reference/data-model#user)

<api-explorer verb="users.get">



</api-explorer>

### `users.me()`

The account the provider's credential belongs to.

**Example**

```ts
const me = await provider.users.me()
console.log(me.login)
```

**Capability:** `users.me`. Anonymous providers reject it.

```ts
users.me(options?: BaseOptions): Promise<User>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<User>`](https://forges.link/reference/data-model#user)

<api-explorer verb="users.me">



</api-explorer>

### `users.sponsorable()`

Whether an account accepts sponsorship on the forge, such as through a GitHub Sponsors listing. Rejects with
`NotFoundError` when no account has the login.

**Example**

```ts
if (await provider.users.sponsorable('danielroe')) {
  console.log('https://github.com/sponsors/danielroe')
}
```

**Capability:** `users.sponsorable`. Anonymous providers reject it.

```ts
users.sponsorable(login: string, options?: BaseOptions): Promise<boolean>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        login
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The account to check.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
    
    <td>
      
    </td>
  </tr>
</tbody>
</table>

**Returns:** `Promise<boolean>`

<api-explorer verb="users.sponsorable">



</api-explorer>

### `users.events()`

Lists what an account did across the repositories the credential can see, in the feed's order as for
`ReposApi.events`. Each event has `source: 'poll'`.

**Capability:** `users.events`.

```ts
users.events(login: string, options?: EventFeedOptions): ForgeIterable<ForgeEvent>
users.eventsPage(login: string, options?: EventFeedOptions): Promise<Page<ForgeEvent>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        login
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#eventfeedoptions">
        <code>
          EventFeedOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `users.events()`: [`ForgeIterable<ForgeEvent>`](https://forges.link/reference/data-model#forgeevent)
- `users.eventsPage()`: [`Promise<Page<ForgeEvent>>`](https://forges.link/reference/data-model#forgeevent)

<api-explorer verb="users.events">



</api-explorer>

## `provider.installations`

The installations of the app that the provider authenticates as.

### `installations.list()`

Lists the installations of the app.

**Capability:** `installations`. Anonymous providers reject it.

```ts
installations.list(options?: PageOptions): ForgeIterable<Installation>
installations.listPage(options?: PageOptions): Promise<Page<Installation>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `installations.list()`: [`ForgeIterable<Installation>`](https://forges.link/reference/data-model#installation)
- `installations.listPage()`: [`Promise<Page<Installation>>`](https://forges.link/reference/data-model#installation)

### `installations.get()`

Reads one installation.

**Capability:** `installations`. Anonymous providers reject it.

```ts
installations.get(installation: Installation | string, options?: BaseOptions): Promise<Installation>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        installation
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#installation">
        <code>
          Installation | string
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<Installation>`](https://forges.link/reference/data-model#installation)

### `installations.token()`

Mints (or reuses a cached) installation token.

**Capability:** `installations`. Anonymous providers reject it.

```ts
installations.token(installation: Installation | string, options?: BaseOptions): Promise<InstallationToken>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        installation
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#installation">
        <code>
          Installation | string
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#baseoptions">
        <code>
          BaseOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`Promise<InstallationToken>`](https://forges.link/reference/data-model#installationtoken)

### `installations.repos()`

Lists the repositories that an installation can access.

**Capability:** `installations`. Anonymous providers reject it.

```ts
installations.repos(installation: Installation | string, options?: PageOptions): ForgeIterable<Repo>
installations.reposPage(installation: Installation | string, options?: PageOptions): Promise<Page<Repo>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        installation
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#installation">
        <code>
          Installation | string
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `installations.repos()`: [`ForgeIterable<Repo>`](https://forges.link/reference/data-model#repo)
- `installations.reposPage()`: [`Promise<Page<Repo>>`](https://forges.link/reference/data-model#repo)

### `installations.provider()`

Provider authenticated as one installation, sharing this instance's app credentials.

**Capability:** `installations`. Anonymous providers reject it.

```ts
installations.provider(installation: Installation | string): ForgeProvider
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        installation
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#installation">
        <code>
          Installation | string
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:** [`ForgeProvider`](https://forges.link/reference/provider)

### `installations.providers()`

One provider per installation.

**Capability:** `installations`. Anonymous providers reject it.

```ts
installations.providers(): AsyncIterable<{ installation: Installation, provider: ForgeProvider }>
```

**Returns:** `AsyncIterable<{ installation: Installation, provider: ForgeProvider }>`

## `provider.orgs`

The teams of an organisation and their members. An organisation is a
namespace ref, as `repos.byOwner()` takes one. GitLab has no teams of its
own, so its subgroups play the role of teams and their members are the
subgroup's members.

### `orgs.teams()`

Lists the teams of an organisation.

**Capability:** `orgs.teams`.

```ts
orgs.teams(org: RepoRef, options?: PageOptions): ForgeIterable<Team>
orgs.teamsPage(org: RepoRef, options?: PageOptions): Promise<Page<Team>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        org
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reporef">
        <code>
          RepoRef
        </code>
      </a>
    </td>
    
    <td>
      A namespace ref, such as <code>
        { forge, instance, owner: 'acme', name: '', kind: 'namespace' }
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
    
    <td>
      
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `orgs.teams()`: [`ForgeIterable<Team>`](https://forges.link/reference/data-model#team)
- `orgs.teamsPage()`: [`Promise<Page<Team>>`](https://forges.link/reference/data-model#team)

<api-explorer verb="orgs.teams">



</api-explorer>

### `orgs.teamMembers()`

Lists the members of a team, as actors.

**Capability:** `orgs.teamMembers`. Anonymous providers reject it.

```ts
orgs.teamMembers(team: TeamRef, options?: PageOptions): ForgeIterable<Actor>
orgs.teamMembersPage(team: TeamRef, options?: PageOptions): Promise<Page<Actor>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        team
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#teamref">
        <code>
          TeamRef
        </code>
      </a>
    </td>
    
    <td>
      A team's <code>
        ref
      </code>
      
       from <code>
        teams()
      </code>
      
      , or a ref with only <code>
        org
      </code>
      
       and <code>
        slug
      </code>
      
      , such as <code>
        { forge, instance, org, slug: 'stewards' }
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/requests#pageoptions">
        <code>
          PageOptions
        </code>
      </a>
    </td>
    
    <td>
      
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `orgs.teamMembers()`: [`ForgeIterable<Actor>`](https://forges.link/reference/data-model#actor)
- `orgs.teamMembersPage()`: [`Promise<Page<Actor>>`](https://forges.link/reference/data-model#actor)

<api-explorer verb="orgs.teamMembers">



</api-explorer>

## `provider.search`

Searching issues and pull requests, repositories, commits and code across the forge.

### `search.threads()`

Issues and pull requests across repositories. Fields the forge cannot
filter on come back as a `filter_unsupported` warning on the page.

**Capability:** `search.threads`.

```ts
search.threads(query: SearchQuery): ForgeIterable<Thread>
search.threadsPage(query: SearchQuery): Promise<Page<Thread>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        query
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#searchquery">
        <code>
          SearchQuery
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `search.threads()`: [`ForgeIterable<Thread>`](https://forges.link/reference/data-model#thread)
- `search.threadsPage()`: [`Promise<Page<Thread>>`](https://forges.link/reference/data-model#thread)

<api-explorer verb="search.threads">



</api-explorer>

### `search.repos()`

Searches repositories.

**Capability:** `search.repos`.

```ts
search.repos(query: RepoSearchQuery): ForgeIterable<Repo>
search.reposPage(query: RepoSearchQuery): Promise<Page<Repo>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        query
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#reposearchquery">
        <code>
          RepoSearchQuery
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `search.repos()`: [`ForgeIterable<Repo>`](https://forges.link/reference/data-model#repo)
- `search.reposPage()`: [`Promise<Page<Repo>>`](https://forges.link/reference/data-model#repo)

<api-explorer verb="search.repos">



</api-explorer>

### `search.commits()`

Commits across repositories, where the forge indexes them.

**Capability:** `search.commits`.

```ts
search.commits(query: CommitSearchQuery): ForgeIterable<Commit>
search.commitsPage(query: CommitSearchQuery): Promise<Page<Commit>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        query
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#commitsearchquery">
        <code>
          CommitSearchQuery
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `search.commits()`: [`ForgeIterable<Commit>`](https://forges.link/reference/data-model#commit)
- `search.commitsPage()`: [`Promise<Page<Commit>>`](https://forges.link/reference/data-model#commit)

<api-explorer verb="search.commits">



</api-explorer>

### `search.code()`

Searches the contents of files, where the forge indexes them.

**Capability:** `search.code`.

```ts
search.code(query: CodeSearchQuery): ForgeIterable<CodeMatch>
search.codePage(query: CodeSearchQuery): Promise<Page<CodeMatch>>
```

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        query
      </code>
    </td>
    
    <td>
      <a href="https://forges.link/reference/data-model#codesearchquery">
        <code>
          CodeSearchQuery
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

**Returns:**

- `search.code()`: [`ForgeIterable<CodeMatch>`](https://forges.link/reference/data-model#codematch)
- `search.codePage()`: [`Promise<Page<CodeMatch>>`](https://forges.link/reference/data-model#codematch)


## Sitemap

See the full [sitemap](https://forges.link/sitemap.md) for all pages.
