@octokit/types
Advanced tools
Comparing version 2.8.2 to 2.9.0
{ | ||
"name": "@octokit/types", | ||
"version": "2.8.2", | ||
"version": "2.9.0", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
@@ -11,2 +11,19 @@ # types.ts | ||
Get parameter and response data types for a REST API endpoint | ||
```ts | ||
import { Endpoints } from "./src"; | ||
type listUserReposParameters = Endpoints["GET /repos/:owner/:repo"]["parameters"]; | ||
type listUserReposResponse = Endpoints["GET /repos/:owner/:repo"]["response"]; | ||
async function listRepos( | ||
options: listUserReposParameters | ||
): listUserReposResponse["data"] { | ||
// ... | ||
} | ||
``` | ||
Get parameter types for a REST API endpoint | ||
Get response types from endpoint methods | ||
@@ -13,0 +30,0 @@ |
@@ -26,5 +26,5 @@ import { EndpointDefaults } from "./EndpointDefaults"; | ||
options?: R extends keyof Endpoints | ||
? Endpoints[R][0] & RequestParameters | ||
? Endpoints[R]["parameters"] & RequestParameters | ||
: RequestParameters | ||
): R extends keyof Endpoints ? Endpoints[R][1] : RequestOptions; | ||
): R extends keyof Endpoints ? Endpoints[R]["request"] : RequestOptions; | ||
@@ -31,0 +31,0 @@ /** |
@@ -20,1 +20,2 @@ export * from "./AuthInterface"; | ||
export * from "./GetResponseTypeFromEndpointMethod"; | ||
export * from "./generated/Endpoints"; |
@@ -26,6 +26,6 @@ import { EndpointInterface } from "./EndpointInterface"; | ||
options?: R extends keyof Endpoints | ||
? Endpoints[R][0] & RequestParameters | ||
? Endpoints[R]["parameters"] & RequestParameters | ||
: RequestParameters | ||
): R extends keyof Endpoints | ||
? Promise<OctokitResponse<Endpoints[R][2]>> | ||
? Promise<Endpoints[R]["response"]> | ||
: Promise<OctokitResponse<any>>; | ||
@@ -32,0 +32,0 @@ |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "2.8.2"; | ||
export const VERSION = "2.9.0"; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1116285
41832
55