-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
types-rest-api-ghes-3.2-compatible
and `types-rest-api-github…
….ae-compatible` (#35)
- Loading branch information
Showing
15 changed files
with
460 additions
and
97 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
{ | ||
"name": "@octokit-next/types-rest-api-ghes-3.0-compatible", | ||
"publishConfig": { | ||
"access": "public" | ||
"author": "Gregor Martynus (https://twitter.com/gr2m)", | ||
"dependencies": { | ||
"@octokit-next/types": "0.0.0-development", | ||
"@octokit-next/types-openapi-ghes-3.0": "0.0.0-development" | ||
}, | ||
"type": "module", | ||
"version": "0.0.0-development", | ||
"description": "Types for GHES 3.0 (compatible) REST API requests and responses", | ||
"types": "./index.d.ts", | ||
"homepage": "https://github.com/octokit/octokit-next.js/tree/main/packages/types-rest-api-ghes-3.0-compatible#readme", | ||
"license": "MIT", | ||
"name": "@octokit-next/types-rest-api-ghes-3.0-compatible", | ||
"octokit": { "openapi-version": "5.2.2" }, | ||
"publishConfig": { "access": "public" }, | ||
"repository": { | ||
"directory": "packages/types-rest-api-ghes-3.0-compatible", | ||
"type": "git", | ||
"url": "https://github.com/octokit/octokit-next.js.git", | ||
"directory": "packages/types-rest-api-ghes-3.0-compatible" | ||
"url": "https://github.com/octokit/octokit-next.js.git" | ||
}, | ||
"homepage": "https://github.com/octokit/octokit-next.js/tree/main/packages/types-rest-api-ghes-3.0-compatible#readme", | ||
"author": "Gregor Martynus (https://twitter.com/gr2m)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@octokit-next/types": "0.0.0-development", | ||
"@octokit-next/types-rest-api": "0.0.0-development" | ||
} | ||
"type": "module", | ||
"types": "index.d.ts", | ||
"version": "0.0.0-development" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
{ | ||
"name": "@octokit-next/types-rest-api-ghes-3.0", | ||
"description": "Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/octokit/octokit-next.js.git", | ||
"directory": "packages/types-rest-api-ghes-3.0" | ||
}, | ||
"author": "Gregor Martynus (https://twitter.com/gr2m)", | ||
"dependencies": { | ||
"@octokit-next/types": "0.0.0-development", | ||
"@octokit-next/types-openapi-ghes-3.0": "0.0.0-development", | ||
"@octokit-next/types-rest-api": "0.0.0-development", | ||
"@octokit-next/types-rest-api-ghes-3.1": "0.0.0-development", | ||
"type-fest": "^2.0.0" | ||
}, | ||
"description": "Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com", | ||
"homepage": "https://github.com/octokit/octokit-next.js/tree/main/packages/types-rest-api-ghes-3.0#readme", | ||
"license": "MIT", | ||
"name": "@octokit-next/types-rest-api-ghes-3.0", | ||
"octokit": { "openapi-version": "5.2.2" }, | ||
"publishConfig": { "access": "public" }, | ||
"version": "0.0.0-development", | ||
"repository": { | ||
"directory": "packages/types-rest-api-ghes-3.0", | ||
"type": "git", | ||
"url": "https://github.com/octokit/octokit-next.js.git" | ||
}, | ||
"type": "module", | ||
"types": "index.d.ts", | ||
"author": "Gregor Martynus (https://twitter.com/gr2m)", | ||
"license": "MIT", | ||
"octokit": { "openapi-version": "5.2.2" } | ||
"version": "0.0.0-development" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
{ | ||
"name": "@octokit-next/types-rest-api-ghes-3.1-compatible", | ||
"publishConfig": { | ||
"access": "public" | ||
"author": "Gregor Martynus (https://twitter.com/gr2m)", | ||
"dependencies": { | ||
"@octokit-next/types": "0.0.0-development", | ||
"@octokit-next/types-openapi-ghes-3.1": "0.0.0-development" | ||
}, | ||
"type": "module", | ||
"version": "0.0.0-development", | ||
"description": "Types for GHES 3.1 (compatible) REST API requests and responses", | ||
"types": "./index.d.ts", | ||
"homepage": "https://github.com/octokit/octokit-next.js/tree/main/packages/types-rest-api-ghes-3.1-compatible#readme", | ||
"license": "MIT", | ||
"name": "@octokit-next/types-rest-api-ghes-3.1-compatible", | ||
"octokit": { "openapi-version": "5.2.2" }, | ||
"publishConfig": { "access": "public" }, | ||
"repository": { | ||
"directory": "packages/types-rest-api-ghes-3.1-compatible", | ||
"type": "git", | ||
"url": "https://github.com/octokit/octokit-next.js.git", | ||
"directory": "packages/types-rest-api-ghes-3.1-compatible" | ||
"url": "https://github.com/octokit/octokit-next.js.git" | ||
}, | ||
"homepage": "https://github.com/octokit/octokit-next.js/tree/main/packages/types-rest-api-ghes-3.1-compatible#readme", | ||
"author": "Gregor Martynus (https://twitter.com/gr2m)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@octokit-next/types": "0.0.0-development", | ||
"@octokit-next/types-rest-api": "0.0.0-development" | ||
} | ||
"type": "module", | ||
"types": "index.d.ts", | ||
"version": "0.0.0-development" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
{ | ||
"name": "@octokit-next/types-rest-api-ghes-3.1", | ||
"description": "Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/octokit/octokit-next.js.git", | ||
"directory": "packages/types-rest-api-ghes-3.1" | ||
}, | ||
"author": "Gregor Martynus (https://twitter.com/gr2m)", | ||
"dependencies": { | ||
"@octokit-next/types": "0.0.0-development", | ||
"@octokit-next/types-openapi-ghes-3.1": "0.0.0-development", | ||
"@octokit-next/types-rest-api": "0.0.0-development", | ||
"@octokit-next/types-rest-api-ghes-3.2": "0.0.0-development", | ||
"type-fest": "^2.0.0" | ||
}, | ||
"description": "Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com", | ||
"homepage": "https://github.com/octokit/octokit-next.js/tree/main/packages/types-rest-api-ghes-3.1#readme", | ||
"license": "MIT", | ||
"name": "@octokit-next/types-rest-api-ghes-3.1", | ||
"octokit": { "openapi-version": "5.2.2" }, | ||
"publishConfig": { "access": "public" }, | ||
"version": "0.0.0-development", | ||
"repository": { | ||
"directory": "packages/types-rest-api-ghes-3.1", | ||
"type": "git", | ||
"url": "https://github.com/octokit/octokit-next.js.git" | ||
}, | ||
"type": "module", | ||
"types": "index.d.ts", | ||
"author": "Gregor Martynus (https://twitter.com/gr2m)", | ||
"license": "MIT", | ||
"octokit": { "openapi-version": "5.2.2" } | ||
"version": "0.0.0-development" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# `@octokit-next/types-rest-api-ghes-3.2-compatible` | ||
|
||
> Types for GHES 3.2 (compatible) REST API requests and responses | ||
🚫⚠️ This package is part of an experimental Octokit SDK for testing purpose only - DO NOT USE | ||
|
||
[learn more](https://github.com/octokit/octokit-next.js) | ||
|
||
The goal for this package is to enable developers to build code that will work in both environments: github.com and GHES 3.2. Only endpoints and properties that exist in both have types by default. | ||
|
||
The version can be overwritten on a per-request basis as needed. | ||
|
||
## Usage | ||
|
||
```ts | ||
const octokit = new Octokit({ | ||
version: "ghes-3.2-compatible", | ||
}); | ||
const response = await octokit.request("GET /"); | ||
``` | ||
|
||
The routes suggested for `octokit.request(route)` are only the ones that exist for `version: "github.com"` and have no overrides for `version: "ghes-3.2"`. The same is true for `response.headers`. | ||
|
||
To override the version specified in the constructor it can be set using the `request.version` option | ||
|
||
```ts | ||
const ghesOnlyResponse = await octokit.request("GET /admins/users", { | ||
request: { | ||
version: "ghes-3.2", | ||
}, | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Octokit } from "@octokit-next/types"; | ||
|
||
import { | ||
EndpointsDiff, | ||
ResponseHeadersDiff, | ||
} from "@octokit-next/types-rest-api-ghes-3.2"; | ||
|
||
export type ResponseHeadersCompatible = Omit< | ||
Octokit.ResponseHeaders, | ||
keyof ResponseHeadersDiff | ||
>; | ||
|
||
export type EndpointsCompatible = Omit<Octokit.Endpoints, keyof EndpointsDiff>; | ||
|
||
declare module "@octokit-next/types" { | ||
namespace Octokit { | ||
interface ApiVersions { | ||
"ghes-3.2-compatible": { | ||
ResponseHeaders: ResponseHeadersCompatible; | ||
|
||
Endpoints: { | ||
[route in keyof EndpointsCompatible]: { | ||
parameters: EndpointsCompatible[route]["parameters"]; | ||
response: Octokit.Response< | ||
EndpointsCompatible[route]["response"]["data"], | ||
EndpointsCompatible[route]["response"]["status"], | ||
ResponseHeadersCompatible | ||
>; | ||
}; | ||
}; | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"author": "Gregor Martynus (https://twitter.com/gr2m)", | ||
"dependencies": { | ||
"@octokit-next/types": "0.0.0-development", | ||
"@octokit-next/types-openapi-ghes-3.2": "0.0.0-development" | ||
}, | ||
"description": "Types for GHES 3.2 (compatible) REST API requests and responses", | ||
"homepage": "https://github.com/octokit/octokit-next.js/tree/main/packages/types-rest-api-ghes-3.2-compatible#readme", | ||
"license": "MIT", | ||
"name": "@octokit-next/types-rest-api-ghes-3.2-compatible", | ||
"octokit": { "openapi-version": "5.2.2" }, | ||
"publishConfig": { "access": "public" }, | ||
"repository": { | ||
"directory": "packages/types-rest-api-ghes-3.2-compatible", | ||
"type": "git", | ||
"url": "https://github.com/octokit/octokit-next.js.git" | ||
}, | ||
"type": "module", | ||
"types": "index.d.ts", | ||
"version": "0.0.0-development" | ||
} |
Oops, something went wrong.