v16.0.1
To upgrade to v16, make sure you have the latest v15 release installed first:
npm install @octokit/rest@15.18
Now run the tests and look for DEPRECATED
messages in the logs. Once you see no more deprecations, upgrading to v16 should cause no problems.
BREAKING CHANGES
-
all previously deprecated methods have been removed
-
preview headers that are not required to use an API have been removed
-
.gitdata.getTags()
has been removed. Use.gitdata.listRefs({namespace: tags})
instead -
Methods for undocumented endpoints have been removed.
Instead of
octokit.users.getById({id})
useoctokit.request('GET /user/:id', {id})
Instead ofoctokit.repos.getById({id})
useoctokit.request('GET /repositories/:id', {id})
-
octokit.enterprise.*
methods have been removed. They have been moved tot the@octokit/enterprise-rest
plugin -
octokit.issues.addLabels
sendslabels
parameter with "labels
" namespace instead of sending the array in the request body root. This is not supported by GitHub Enterprise 2.15 or older. You have several options.- Use the
@octokit/enterprise-compatibility
plugin - Use the
@octokit/enterprise-rest
plugin loading all routes for the GHE version you want to support - Use
octokit.request()
directly:
octokit.request('/repos/:owner/:repo/issues/:number/labels', { owner, repo, number, data: ['label1', 'label2'] })
- Use the
-
The
milestone
parameter is no longer validated using a regex as it cannot be derived from octokit/routes -
Dropped support for node 4
-
error.message is no longer a JSON string containing GitHub’s error message. Instead the JSON is parsed internally and error properties are assigned with its value. This is not technically a breaking change but a bug fix, but as this bug was around for a long time and plenty of apps depend on
JSON.parse(error.message)
to be working, we treat it as a breaking change by way of precaution -
error.status
is now the response status code number. The status text is no longer returned
Features
- .paginate(options, mapFn) (8084afd)
- octokit.paginate & octokit.paginate.iterator (00a692f)
- octokit.registerEndpoints() (08a3c51)
- octokit.request & octokit.request.endpoint (1fdfbf0)
- plugin API (70e114a)
- rename methods to align more closely to the documentation at https://developer.github.com/v3/ (10b4f34), closes /developer.github.com/v3/repos/commits/#get-the-sha-1
Bug Fixes
- routes: remove validation for milestone parameter as it cannot be derived from octokit/routes (4d04d17)
- only set preview headers required to use the API (1628821)
- parse JSON from GitHub error messages (dd6306e)
Continuous Integration
- travis: drop tests in node 4 & 9, test in node 10 (ad8b1e5)
Bug Fixes in v16.0.1
- typescript: Adding return types (18ac5bf), closes #1116
- typescript: Adding the
noImplicitAny
flag tovalidate:ts
(ef4d35a) - typescript: Github.plugin is a static method, not an instance method (01763bf)
- typescript: include a
header
object when transformingContent-Type
andContent-Length
toheaders.content-type
andheaders.content-length
(0b9cc37)
Thanks @mamodom for your great help with these Typescript fixes 💐