@octokit/plugin-enterprise-compatibility
TypeScript icon, indicating that this package has built-in type declarations

5.0.0 • Public • Published

plugin-enterprise-compatibility.js

Octokit plugin for improving GHE compatibility

@latest Build Status

The GitHub API teams is continuously improving existing APIs to make the overall platform more consistent. For example, the Add labels to an issue expected the label names array to be sent directly in the request body root, as you can still see in the documentation for GHE 2.15.

While consistency is great, changing like the above makes the current octokit.issues.addLabels() incompatible with GHE v2.15 and older. If you require compatibility with GHE versions, you can use the Enterprise rest plugin, but that will remove new endpoint methods that are not available on Enterprise yet.

As a compromise, this plugin is reverting changes such as the one above to remain compatible with currently supported GitHub enterprise versions.

Usage

Browsers

Load @octokit/plugin-enterprise-compatibility and @octokit/core (or core-compatible module) directly from esm.sh

<script type="module">
  import { Octokit } from "https://esm.sh/@octokit/core";
  import { enterpriseCompatibility } from "https://esm.sh/@octokit/plugin-enterprise-compatibility";
</script>
Node

Install with npm install @octokit/core @octokit/plugin-enterprise-compatibility. Optionally replace @octokit/core with a core-compatible module

import { Octokit } from "@octokit/core";
import { enterpriseCompatibility } from "@octokit/plugin-enterprise-compatibility";
const MyOctokit = Octokit.plugin(enterpriseCompatibility);
const octokit = new MyOctokit({
  auth: "token123",
});

octokit.request("POST /repos/{owner}/{repo}/issues/{issue_number}/labels", {
  owner,
  repo,
  number,
  labels: ["foo", "bar"],
});
// sends ["foo", "bar"] instead of {"labels":["foo", "bar"]} as request body

LICENSE

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
5.0.0
515latest

Version History

VersionDownloads (Last 7 Days)Published
5.0.0
515
4.1.0
4,987
4.0.11,137
4.0.01
3.0.30
3.0.21
3.0.10
3.0.01
2.0.5943
2.0.43
2.0.3153
2.0.227
2.0.10
2.0.00
1.3.0110,408
1.2.125
1.2.1157
1.2.10102
1.2.9432
1.2.8226
1.2.70
1.2.6521
1.2.5721
1.2.417
1.2.31
1.2.2190
1.2.11,360
1.2.00
1.1.11,234
1.1.0236
1.0.00

Package Sidebar

Install

npm i @octokit/plugin-enterprise-compatibility

Weekly Downloads

103,776

Version

5.0.0

License

MIT

Unpacked Size

9.86 kB

Total Files

12

Last publish

Collaborators

  • kfcampbell
  • nickfloyd
  • gr2m
  • octokitbot