Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using @octokit/types #17

Merged
merged 1 commit into from
Nov 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
},
"homepage": "https://github.com/octokit/request-error.js#readme",
"dependencies": {
"@octokit/types": "^2.0.0",
"deprecation": "^2.0.0",
"once": "^1.4.0"
},
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Deprecation } from "deprecation";
import once from "once";
const logOnce = once((deprecation: any) => console.warn(deprecation));

import { RequestOptions, ResponseHeaders, RequestErrorOptions } from "./types";
import { RequestOptions, ResponseHeaders } from "@octokit/types";
import { RequestErrorOptions } from "./types";

/**
* Error with extra properties to help with debugging
Expand Down
41 changes: 1 addition & 40 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,4 @@
/**
* Relative or absolute URL. Examples: `'/orgs/:org'`, `https://example.com/foo/bar`
*/
export type Url = string;

/**
* Request method
*/
export type Method = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";

export type RequestHeaders = {
/**
* Used for API previews and custom formats
*/
accept?: string;
/**
* Redacted authorization header
*/
authorization?: string;

"user-agent"?: string;

[header: string]: string | number | undefined;
};

export type ResponseHeaders = {
[header: string]: string;
};

export type EndpointRequestOptions = {
[option: string]: any;
};

export type RequestOptions = {
method: Method;
url: Url;
headers: RequestHeaders;
body?: any;
request?: EndpointRequestOptions;
};
import { RequestOptions, ResponseHeaders } from "@octokit/types";

export type RequestErrorOptions = {
headers: ResponseHeaders;
Expand Down