Experimental Octokit SDK for exploration only - DO NOT USE 🚫⚠️
We use this repository to implement new features without the legacy of the current Octokit
implementation.
This project is built as a monorepo using npm workspaces and is publishing native ES Modules. To set it up and run the tests Node 18 is required.
Currently working on:
⚠️ This is an experimental SDK not meant for actual usage.
import { Octokit } from "octokit-next";
const octokit = new Octokit();
const { data } = await octokit.request("GET /repos/{owner}/{repo}", {
owner: "octokit",
repo: "octokit-next.js",
});
console.log(data);
A list of breaking changes compared to latest @octokit/*
modules
Node 16 and other JavaScript runtime environments that lack a global fetch()
method are no longer supported out-of-the-box. A fetch
method such as provided by the node-fetch
npm module can be passed to make Octokit work in these environments.
For @octokit-next/core
and other SDKs built upon it you can do this
import { Octokit } from "octokit-next";
import fetch from "node-fetch";
const octokit = new Octokit({ request: { fetch } });
For the static @octokit-next/request
method you can do this
import { request } from "@octokit-next/request";
import fetch from "node-fetch";
const result = await request("GET /", { request: { fetch } });
Octokit.defaults
is now Octokit.withDefaults
Octokit.plugin
is now Octokit.withPlugins
. Instead of accepting one argument per plugin, the method now accepts a single array argument with all plugins to be applied.
@octokit/openapi-types
will be renamed to @octokit/types-openapi
to be consistents with the @octokit/types-*
prefixed packages that only contain types
@octokit/auth-token
: createTokenAuth()
no longer accepts a token
string argument, but requires options.token
.
plugins now receive all options passed to the Octokit
constructor as well as its defaults. Previously only the options passed to the constructor were passed
Octokit.DEFAULTS
octokit.options
request.defaults()
and endpoint.defaults()
with request.withDefaults()
and endpoint.withDefaults()
options.previews
from new Octokit(options)
packages/*
folders and release.plugins
configuration in package.json
are in syncscripts/types-rest-api-diff/update.js
- remove all package folders before re-creating, so that obsolete packages get removedoptions.auth
) are not set correctly when authStrategy
is set via .withDefaults({ authStrategy })
(#20)