Skip to content

Commit

Permalink
Merge branch 'beta' into renovate/major-octokit-monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy1339 committed Jun 18, 2023
2 parents f246204 + 6090ab4 commit 92f3669
Show file tree
Hide file tree
Showing 5 changed files with 327 additions and 10,435 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ jobs:
strategy:
matrix:
node_version:
- 14
- 16
- 18
- 20
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node_version }}
Expand Down
23 changes: 4 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The `octokit` package integrates the three main Octokit libraries
- [`octokit.rest` endpoint methods](#octokitrest-endpoint-methods)
- [`octokit.request()`](#octokitrequest)
- [Pagination](#pagination)
- [Media Type previews and formats](#media-type-previews-and-formats)
- [Media Type formats](#media-type-formats)
- [GraphQL API queries](#graphql-api-queries)
- [Schema previews](#schema-previews)
- [App client](#app-client)
Expand Down Expand Up @@ -514,11 +514,9 @@ const issues = await octokit.paginate(octokit.rest.issues.listForRepo, {
});
```

#### Media Type previews and formats
#### Media Type formats

**Note**: The concept of _preview headers_ has been deprecated from REST API endpoints hosted via `api.github.com` but it still exists in GHES (GitHub Enterprise Server) version 3.2 and below. Instead of using _preview headers_ going forward, new features are now being tested using beta previews that users will have to opt-in to.

Media type previews and formats can be set using `mediaType: { format, previews }` on every request. Required API previews are set automatically on the respective REST API endpoint methods.
Media type formats can be set using `mediaType: { format }` on every request.

Example: retrieve the raw content of a `package.json` file

Expand All @@ -534,20 +532,7 @@ const { data } = await octokit.rest.repos.getContent({
console.log("package name: %s", JSON.parse(data).name);
```

Example: retrieve a repository with topics

```js
const { data } = await octokit.rest.repos.getContent({
mediaType: {
previews: ["mercy"],
},
owner: "octocat",
repo: "hello-world",
});
console.log("topics on octocat/hello-world: %j", data.topics);
```

Learn more about [Media type formats](https://docs.github.com/en/rest/overview/media-types) and [previews](https://docs.github.com/en/enterprise-server@3.2/rest/overview/api-previews) used on GitHub Enterprise Server.
Learn more about [Media type formats](https://docs.github.com/en/rest/overview/media-types).

### GraphQL API queries

Expand Down
Loading

0 comments on commit 92f3669

Please sign in to comment.