Skip to content

Commit 9808d3f

Browse files
committed
feat: Octokit.defaults(options)
1 parent 08515fe commit 9808d3f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ import { VERSION } from "./version";
88
import { withAuthorizationPrefix } from "./auth";
99

1010
export class Octokit {
11+
static defaults(defaults: OctokitOptions) {
12+
return class OctokitWithDefaults extends this {
13+
static defaults(newDefaults: OctokitOptions): typeof Octokit {
14+
return Octokit.defaults(Object.assign({}, defaults, newDefaults));
15+
}
16+
17+
constructor(options: OctokitOptions = {}) {
18+
super(Object.assign({}, defaults, options));
19+
}
20+
};
21+
}
22+
1123
static plugins: Plugin[] = [];
1224
static plugin(plugins: Plugin | Plugin[]) {
1325
const currentPlugins = this.plugins;

0 commit comments

Comments
 (0)