-Browsers - |
-Load @octokit/endpoint directly from cdn.pika.dev
-
-```html
-
-```
-
- |
---|---|
-Node - |
-
-Install with npm install @octokit/endpoint
-
-```js
-const { endpoint } = require("@octokit/endpoint");
-// or: import { endpoint } from "@octokit/endpoint";
-```
-
- |
- name - | -- type - | -- description - | -
---|---|---|
- route
- |
- - String - | -
- If set, it has to be a string consisting of URL and the request method, e.g., GET /orgs/:org . If it’s set to a URL, only the method defaults to GET .
- |
-
- options.method
- |
- - String - | -
- Required unless route is set. Any supported http verb. Defaults to GET .
- |
-
- options.url
- |
- - String - | -
- Required unless route is set. A path or full URL which may contain :variable or {variable} placeholders,
- e.g., /orgs/:org/repos . The url is parsed using url-template.
- |
-
- options.baseUrl
- |
- - String - | -
- Defaults to https://api.github.com .
- |
-
- options.headers
- |
- - Object - | -
- Custom headers. Passed headers are merged with defaults: - headers['user-agent'] defaults to octokit-endpoint.js/1.2.3 (where 1.2.3 is the released version).- headers['accept'] defaults to application/vnd.github.v3+json .- |
-
- options.mediaType.format
- |
- - String - | -
- Media type param, such as raw , diff , or text+json . See Media Types. Setting options.mediaType.format will amend the headers.accept value.
- |
-
- options.mediaType.previews
- |
- - Array of Strings - | -
- Name of previews, such as mercy , symmetra , or scarlet-witch . See API Previews. If options.mediaType.previews was set as default, the new previews will be merged into the default ones. Setting options.mediaType.previews will amend the headers.accept value. options.mediaType.previews will be merged with an existing array set using .defaults() .
- |
-
- options.data
- |
- - Any - | -
- Set request body directly instead of setting it to JSON based on additional parameters. See "The data parameter" below.
- |
-
- options.request
- |
- - Object - | -
- Pass custom meta information for the request. The request object will be returned as is.
- |
-
- key - | -- type - | -- description - | -
---|---|---|
method |
- String | -The http method. Always lowercase. | -
url |
- String | -The url with placeholders replaced with passed parameters. | -
headers |
- Object | -All header names are lowercased. | -
body |
- Any | -The request body if one is present. Only for PATCH , POST , PUT , DELETE requests. |
-
request |
- Object | -Request meta option, it will be returned as it was passed into endpoint() |
-
-Browsers - |
-Load @octokit/request-error directly from cdn.pika.dev
-
-```html
-
-```
-
- |
---|---|
-Node - |
-
-Install with npm install @octokit/request-error
-
-```js
-const { RequestError } = require("@octokit/request-error");
-// or: import { RequestError } from "@octokit/request-error";
-```
-
- |
-Browsers - |
-Load @octokit/request directly from cdn.pika.dev
-
-```html
-
-```
-
- |
---|---|
-Node - |
-
-Install with npm install @octokit/request
-
-```js
-const { request } = require("@octokit/request");
-// or: import { request } from "@octokit/request";
-```
-
- |
- name - | -- type - | -- description - | -
---|---|---|
- route
- |
- - String - | -
- If route is set it has to be a string consisting of the request method and URL, e.g. GET /orgs/:org
- |
-
- options.baseUrl
- |
- - String - | -
- Required. Any supported http verb, case insensitive. Defaults to https://api.github.com .
- |
-
- options.headers
- |
- - Object - | -
- Custom headers. Passed headers are merged with defaults: - headers['user-agent'] defaults to octokit-rest.js/1.2.3 (where 1.2.3 is the released version).- headers['accept'] defaults to application/vnd.github.v3+json .Use options.mediaType.{format,previews} to request API previews and custom media types.
- |
-
-
- options.mediaType.format
- |
- - String - | -- Media type param, such as `raw`, `html`, or `full`. See Media Types. - | -
- options.mediaType.previews
- |
- - Array of strings - | -- Name of previews, such as `mercy`, `symmetra`, or `scarlet-witch`. See API Previews. - | -
- options.method
- |
- - String - | -
- Required. Any supported http verb, case insensitive. Defaults to Get .
- |
-
- options.url
- |
- - String - | -
- Required. A path or full URL which may contain :variable or {variable} placeholders,
- e.g. /orgs/:org/repos . The url is parsed using url-template.
- |
-
- options.data
- |
- - Any - | -- Set request body directly instead of setting it to JSON based on additional parameters. See "The `data` parameter" below. - | -
- options.request.agent
- |
- - http(s).Agent instance - | -- Node only. Useful for custom proxy, certificate, or dns lookup. - | -
- options.request.fetch
- |
- - Function - | -- Custom replacement for built-in fetch method. Useful for testing or request hooks. - | -
- options.request.hook
- |
- - Function - | -
- Function with the signature hook(request, endpointOptions) , where endpointOptions are the parsed options as returned by endpoint.merge() , and request is request() . This option works great in conjuction with before-after-hook.
- |
-
- options.request.signal
- |
- - new AbortController().signal - | -
- Use an AbortController instance to cancel a request. In node you can only cancel streamed requests.
- |
-
- options.request.timeout
- |
- - Number - | -- Node only. Request/response timeout in ms, it resets on redirect. 0 to disable (OS limit applies). options.request.signal is recommended instead. - | -
- key - | -- type - | -- description - | -
---|---|---|
status |
- Integer | -Response status status | -
url |
- String | -URL of response. If a request results in redirects, this is the final URL. You can send a HEAD request to retrieve it without loading the full response body. |
-
headers |
- Object | -All response headers | -
data |
- Any | -The response body as returned from server. If the response is JSON then it will be parsed into an object | -