# core.js **Repository Path**: bgoonz/core.js ## Basic Information - **Project Name**: core.js - **Description**: Extendable client for GitHub's REST & GraphQL APIs - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-08-25 - **Last Updated**: 2021-08-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # core.js > Extendable client for GitHub's REST & GraphQL APIs [](https://www.npmjs.com/package/@octokit/core) [](https://github.com/octokit/core.js/actions?query=workflow%3ATest+branch%3Amaster) - [Usage](#usage) - [REST API example](#rest-api-example) - [GraphQL example](#graphql-example) - [Options](#options) - [Defaults](#defaults) - [Authentication](#authentication) - [Logging](#logging) - [Hooks](#hooks) - [Plugins](#plugins) - [Build your own Octokit with Plugins and Defaults](#build-your-own-octokit-with-plugins-and-defaults) - [LICENSE](#license) If you need a minimalistic library to utilize GitHub's [REST API](https://developer.github.com/v3/) and [GraphQL API](https://developer.github.com/v4/) which you can extend with plugins as needed, then `@octokit/core` is a great starting point. If you don't need the Plugin API then using [`@octokit/request`](https://github.com/octokit/request.js/) or [`@octokit/graphql`](https://github.com/octokit/graphql.js/) directly is a good alternative. ## Usage
| Browsers |
Load @octokit/core directly from cdn.skypack.dev
```html
```
|
|---|---|
| Node |
Install with npm install @octokit/core
```js
const { Octokit } = require("@octokit/core");
// or: import { Octokit } from "@octokit/core";
```
|
| name | type | description |
|---|---|---|
options.authStrategy
|
Function |
Defaults to @octokit/auth-token. See Authentication below for examples.
|
options.auth
|
String or Object
|
See Authentication below for examples. |
options.baseUrl
|
String
|
When using with GitHub Enterprise Server, set `options.baseUrl` to the root URL of the API. For example, if your GitHub Enterprise Server's hostname is `github.acme-inc.com`, then set `options.baseUrl` to `https://github.acme-inc.com/api/v3`. Example ```js const octokit = new Octokit({ baseUrl: "https://github.acme-inc.com/api/v3", }); ``` |
options.previews
|
Array of Strings
|
Some REST API endpoints require preview headers to be set, or enable additional features. Preview headers can be set on a per-request basis, e.g. ```js octokit.request("POST /repos/{owner}/{repo}/pulls", { mediaType: { previews: ["shadow-cat"], }, owner, repo, title: "My pull request", base: "master", head: "my-feature", draft: true, }); ``` You can also set previews globally, by setting the `options.previews` option on the constructor. Example: ```js const octokit = new Octokit({ previews: ["shadow-cat"], }); ``` |
options.request
|
Object
|
Set a default request timeout (`options.request.timeout`) or an [`http(s).Agent`](https://nodejs.org/api/http.html#http_class_http_agent) e.g. for proxy usage (Node only, `options.request.agent`). There are more `options.request.*` options, see [`@octokit/request` options](https://github.com/octokit/request.js#request). `options.request` can also be set on a per-request basis. |
options.timeZone
|
String
|
Sets the `Time-Zone` header which defines a timezone according to the [list of names from the Olson database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). ```js const octokit = new Octokit({ timeZone: "America/Los_Angeles", }); ``` The time zone header will determine the timezone used for generating the timestamp when creating commits. See [GitHub's Timezones documentation](https://developer.github.com/v3/#timezones). |
options.userAgent
|
String
|
A custom user agent string for your app or library. Example ```js const octokit = new Octokit({ userAgent: "my-app/v1.2.3", }); ``` |