Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remove previews #2372

Merged
merged 9 commits into from
May 23, 2023
25 changes: 5 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ The `octokit` package integrates the three main Octokit libraries
- [`Octokit` API Client](#octokit-api-client)
- [Constructor options](#constructor-options)
- [Authentication](#authentication)
- [Proxy Servers](#proxy-servers-nodejs-only)
- [Proxy Servers (Node.js only)](#proxy-servers-nodejs-only)
- [REST API](#rest-api)
- [`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