@octokit-next/types-rest-api
TypeScript icon, indicating that this package has built-in type declarations

2.8.0 • Public • Published

@octokit-next/types-rest-api

Types for github.com REST API requests and responses

🚫⚠️ This package is part of an experimental Octokit SDK for testing purpose only - DO NOT USE

learn more

Usage

Importing the package will add all of GitHub's REST API endpoints to the Octokit.ApiVersions["github.com"] interface

import "@octokit-next/types-rest-api";

The package also exports an Operation generic which turns a REST API endpoint defined in a transpiled OpenAPI spec to an Endpoint object with parameters, request, and response keys.

import { paths } from "@octokit-next/types-openapi";
import { Operation } from "@octokit-next/types-rest-api";

type MyEndpoint = Operation<paths, "GET", "/">;

The Operation call signature is

Operation<paths, method, path[, requiredPreview]>
  • paths is the paths object from a transpiled OpenAPI spec using openapi-typescript, such as any of the @octokit-next/types-openapi* packages
  • method is the HTTP method, such as get, post, patch, etc. (lowercase)
  • path is the path to the endpoint, such as /repos/:owner/:repo
  • requiredPreview is a string of the name of the preview if one is required in order to use that endpoint

Readme

Keywords

none

Package Sidebar

Install

npm i @octokit-next/types-rest-api

Weekly Downloads

2

Version

2.8.0

License

MIT

Unpacked Size

233 kB

Total Files

6

Last publish

Collaborators

  • octokit-next-bot
  • gr2m