import { Octokit } from "@octokit/core" ; import * as OctokitTypes from "@octokit/types" ; export { EndpointOptions , RequestInterface , OctokitResponse , RequestParameters , Route , } from "@octokit/types" ; export { PaginatingEndpoints } from "./generated/paginating-endpoints" ; import { PaginatingEndpoints } from "./generated/paginating-endpoints" ; type KnownKeys < T > = Extract < { [ K in keyof T ] : string extends K ? never : number extends K ? never : K ; } extends { [ _ in keyof T ] : infer U ; } ? U : never , keyof T > ; type KeysMatching < T , V > = { [ K in keyof T ] : T [ K ] extends V ? K : never ; } [ keyof T ] ; type KnownKeysMatching < T , V > = KeysMatching < Pick < T , KnownKeys < T > > , V > ; type GetResultsType < T > = T extends { data : any [ ] ; } ? T [ "data" ] : T extends { data : object ; } ? T [ "data" ] [ KnownKeysMatching < T [ "data" ] , any [ ] > ] : never ; type NormalizeResponse < T > = T & { data : GetResultsType < T > ; } ; type DataType < T > = "data" extends keyof T ? T [ "data" ] : unknown ; export interface MapFunction < T = OctokitTypes . OctokitResponse < PaginationResults < unknown > > , M = unknown [ ] > { ( response , done ) : M ; } export type PaginationResults < T = unknown > = T [ ] ; export interface PaginateInterface { param { object } options param { function } mapFn < T , M > ( options , mapFn ) : Promise < PaginationResults < M > > ; param { object } options < T > ( options ) : Promise < PaginationResults < T > > ; param { string } route param { function } mapFn < R extends keyof PaginatingEndpoints , M extends unknown [ ] > ( route , mapFn ) : Promise < M > ; param { string } route param { object } parameters param { function } mapFn < R extends keyof PaginatingEndpoints , M extends unknown [ ] > ( route , parameters , mapFn ) : Promise < M > ; param { string } route param { object } parameters < R extends keyof PaginatingEndpoints > ( route , parameters ? ) : Promise < DataType < PaginatingEndpoints [ R ] [ "response" ] > > ; param { string } route param { object } parameters < T , R extends OctokitTypes . Route = OctokitTypes . Route > ( route , parameters ? ) : Promise < T [ ] > ; param { string } request param { function } mapFn < R extends OctokitTypes . RequestInterface , M extends unknown [ ] > ( request , mapFn ) : Promise < M > ; param { string } request param { object } parameters param { function } mapFn < R extends OctokitTypes . RequestInterface , M extends unknown [ ] > ( request , parameters , mapFn ) : Promise < M > ; param { string } request param { object } parameters < R extends OctokitTypes . RequestInterface > ( request , parameters ? ) : Promise < NormalizeResponse < OctokitTypes . GetResponseTypeFromEndpointMethod < R > > [ "data" ] > ; iterator : { see { link param { object } options < T > ( options ) : AsyncIterableIterator < OctokitTypes . OctokitResponse < PaginationResults < T > > > ; see { link param { string } route param { object } parameters < R extends keyof PaginatingEndpoints > ( route , parameters ? ) : AsyncIterableIterator < OctokitTypes . OctokitResponse < DataType < PaginatingEndpoints [ R ] [ "response" ] > > > ; see { link param { string } route param { object } parameters < T , R extends OctokitTypes . Route = OctokitTypes . Route > ( route , parameters ? ) : AsyncIterableIterator < OctokitTypes . OctokitResponse < PaginationResults < T > > > ; see { link param { string } request param { object } parameters < R extends OctokitTypes . RequestInterface > ( request , parameters ? ) : AsyncIterableIterator < NormalizeResponse < OctokitTypes . GetResponseTypeFromEndpointMethod < R > > > ; } ; } export interface ComposePaginateInterface { param { object } octokit param { object } options param { function } mapFn < T , M > ( octokit , options , mapFn ) : Promise < PaginationResults < M > > ; param { object } octokit param { object } options < T > ( octokit , options ) : Promise < PaginationResults < T > > ; param { object } octokit param { string } route param { function } mapFn < R extends keyof PaginatingEndpoints , M extends unknown [ ] > ( octokit , route , mapFn ) : Promise < M > ; param { object } octokit param { string } route param { object } parameters param { function } mapFn < R extends keyof PaginatingEndpoints , M extends unknown [ ] > ( octokit , route , parameters , mapFn ) : Promise < M > ; param { object } octokit param { string } route param { object } parameters < R extends keyof PaginatingEndpoints > ( octokit , route , parameters ? ) : Promise < DataType < PaginatingEndpoints [ R ] [ "response" ] > > ; param { object } octokit param { string } route param { object } parameters < T , R extends OctokitTypes . Route = OctokitTypes . Route > ( octokit , route , parameters ? ) : Promise < T [ ] > ; param { object } octokit param { string } request param { function } mapFn < R extends OctokitTypes . RequestInterface , M extends unknown [ ] > ( octokit , request , mapFn ) : Promise < M > ; param { object } octokit param { string } request param { object } parameters param { function } mapFn < R extends OctokitTypes . RequestInterface , M extends unknown [ ] > ( octokit , request , parameters , mapFn ) : Promise < M > ; param { object } octokit param { string } request param { object } parameters < R extends OctokitTypes . RequestInterface > ( octokit , request , parameters ? ) : Promise < NormalizeResponse < OctokitTypes . GetResponseTypeFromEndpointMethod < R > > [ "data" ] > ; iterator : { see { link param { object } octokit param { object } options < T > ( octokit , options ) : AsyncIterableIterator < OctokitTypes . OctokitResponse < PaginationResults < T > > > ; see { link param { object } octokit param { string } route param { object } parameters < R extends keyof PaginatingEndpoints > ( octokit , route , parameters ? ) : AsyncIterableIterator < OctokitTypes . OctokitResponse < DataType < PaginatingEndpoints [ R ] [ "response" ] > > > ; see { link param { object } octokit param { string } route param { object } parameters < T , R extends OctokitTypes . Route = OctokitTypes . Route > ( octokit , route , parameters ? ) : AsyncIterableIterator < OctokitTypes . OctokitResponse < PaginationResults < T > > > ; see { link param { object } octokit param { string } request param { object } parameters < R extends OctokitTypes . RequestInterface > ( octokit , request , parameters ? ) : AsyncIterableIterator < NormalizeResponse < OctokitTypes . GetResponseTypeFromEndpointMethod < R > > > ; } ; }