Skip to content

Commit

Permalink
refactor: use @octokit/types
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Oct 24, 2019
1 parent 69b225c commit fbdc897
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Collection, HookCollection } from "before-after-hook";
import { request } from "@octokit/request";
import { graphql, withCustomRequest } from "@octokit/graphql";

import { OctokitOptions, Parameters, Plugin } from "./types";
import { OctokitOptions, Plugin, RequestParameters } from "./types";
import { VERSION } from "./version";
import { withAuthorizationPrefix } from "./auth";

Expand Down Expand Up @@ -34,7 +34,7 @@ export class Octokit {

constructor(options: OctokitOptions = {}) {
const hook = new Collection();
const requestDefaults: Required<Parameters> = {
const requestDefaults: Required<RequestParameters> = {
baseUrl: request.endpoint.DEFAULTS.baseUrl,
headers: {},
request: Object.assign({}, options.request, {
Expand Down
16 changes: 7 additions & 9 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {
EndpointOptions,
RequestInterface,
RequestRequestOptions
} from "@octokit/types";
import * as OctokitTypes from "@octokit/types";

import { Octokit } from ".";

export type RequestParameters = OctokitTypes.RequestParameters;

export type OctokitOptions = {
auth?: string | AutenticationHook;
request?: RequestRequestOptions;
request?: Octokit.typesRequestRequestOptions;
timeZone?: string;
[option: string]: any;
};
Expand All @@ -17,9 +15,9 @@ interface AutenticationHook {
(options?: any): any;

hook: (
request: RequestInterface,
options: EndpointOptions
) => ReturnType<RequestInterface>;
request: OctokitTypes.RequestInterface,
options: OctokitTypes.EndpointOptions
) => ReturnType<OctokitTypes.RequestInterface>;
}

export type Plugin = (octokit: Octokit, options: OctokitOptions) => void;

0 comments on commit fbdc897

Please sign in to comment.