@octokit/plugin-paginate-rest
Advanced tools
Comparing version 2.5.1 to 2.6.0
@@ -5,3 +5,3 @@ 'use strict'; | ||
const VERSION = "2.5.1"; | ||
const VERSION = "2.6.0"; | ||
@@ -8,0 +8,0 @@ /** |
import { paginate } from "./paginate"; | ||
import { iterator } from "./iterator"; | ||
export const composePaginateRest = Object.assign(paginate, { iterator }); | ||
export const composePaginateRest = Object.assign(paginate, { | ||
iterator, | ||
}); |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "2.5.1"; | ||
export const VERSION = "2.6.0"; |
@@ -1,5 +0,2 @@ | ||
import { paginate } from "./paginate"; | ||
import { iterator } from "./iterator"; | ||
export declare const composePaginateRest: typeof paginate & { | ||
iterator: typeof iterator; | ||
}; | ||
import { ComposePaginateInterface } from "./types"; | ||
export declare const composePaginateRest: ComposePaginateInterface; |
@@ -0,1 +1,2 @@ | ||
import { Octokit } from "@octokit/core"; | ||
import * as OctokitTypes from "@octokit/types"; | ||
@@ -124,1 +125,117 @@ export { EndpointOptions, RequestInterface, OctokitResponse, RequestParameters, Route, } from "@octokit/types"; | ||
} | ||
export interface ComposePaginateInterface { | ||
/** | ||
* Paginate a request using endpoint options and map each response to a custom array | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
* @param {function} mapFn Optional method to map each response to a custom array | ||
*/ | ||
<T, R>(octokit: Octokit, options: OctokitTypes.EndpointOptions, mapFn: MapFunction<T, R>): Promise<PaginationResults<R>>; | ||
/** | ||
* Paginate a request using endpoint options | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
*/ | ||
<T>(octokit: Octokit, options: OctokitTypes.EndpointOptions): Promise<PaginationResults<T>>; | ||
/** | ||
* Paginate a request using a known endpoint route string and map each response to a custom array | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'` | ||
* @param {function} mapFn Optional method to map each response to a custom array | ||
*/ | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(octokit: Octokit, route: R, mapFn: (response: PaginatingEndpoints[R]["response"], done: () => void) => MR): Promise<MR>; | ||
/** | ||
* Paginate a request using a known endpoint route string and parameters, and map each response to a custom array | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'` | ||
* @param {object} parameters URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
* @param {function} mapFn Optional method to map each response to a custom array | ||
*/ | ||
<R extends keyof PaginatingEndpoints, MR extends unknown[]>(octokit: Octokit, route: R, parameters: PaginatingEndpoints[R]["parameters"], mapFn: (response: PaginatingEndpoints[R]["response"], done: () => void) => MR): Promise<MR>; | ||
/** | ||
* Paginate a request using an known endpoint route string | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'` | ||
* @param {object} parameters? URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
*/ | ||
<R extends keyof PaginatingEndpoints>(octokit: Octokit, route: R, parameters?: PaginatingEndpoints[R]["parameters"]): Promise<PaginatingEndpoints[R]["response"]["data"]>; | ||
/** | ||
* Paginate a request using an unknown endpoint route string | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'` | ||
* @param {object} parameters? URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
*/ | ||
<T, R extends OctokitTypes.Route = OctokitTypes.Route>(octokit: Octokit, route: R, parameters?: R extends keyof PaginatingEndpoints ? PaginatingEndpoints[R]["parameters"] : OctokitTypes.RequestParameters): Promise<T[]>; | ||
/** | ||
* Paginate a request using an endpoint method and a map function | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {string} request Request method (`octokit.request` or `@octokit/request`) | ||
* @param {function} mapFn? Optional method to map each response to a custom array | ||
*/ | ||
<R extends OctokitTypes.RequestInterface, MR extends unknown[]>(octokit: Octokit, request: R, mapFn: (response: NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, done: () => void) => MR): Promise<MR>; | ||
/** | ||
* Paginate a request using an endpoint method, parameters, and a map function | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {string} request Request method (`octokit.request` or `@octokit/request`) | ||
* @param {object} parameters URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
* @param {function} mapFn? Optional method to map each response to a custom array | ||
*/ | ||
<R extends OctokitTypes.RequestInterface, MR extends unknown[]>(octokit: Octokit, request: R, parameters: Parameters<R>[0], mapFn: (response: NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>, done?: () => void) => MR): Promise<MR>; | ||
/** | ||
* Paginate a request using an endpoint method and parameters | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {string} request Request method (`octokit.request` or `@octokit/request`) | ||
* @param {object} parameters? URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
*/ | ||
<R extends OctokitTypes.RequestInterface>(octokit: Octokit, request: R, parameters?: Parameters<R>[0]): Promise<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>["data"]>; | ||
iterator: { | ||
/** | ||
* Get an async iterator to paginate a request using endpoint options | ||
* | ||
* @see {link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of} for await...of | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
*/ | ||
<T>(octokit: Octokit, EndpointOptions: OctokitTypes.EndpointOptions): AsyncIterableIterator<OctokitTypes.OctokitResponse<PaginationResults<T>>>; | ||
/** | ||
* Get an async iterator to paginate a request using a known endpoint route string and optional parameters | ||
* | ||
* @see {link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of} for await...of | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'` | ||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
*/ | ||
<R extends keyof PaginatingEndpoints>(octokit: Octokit, route: R, parameters?: PaginatingEndpoints[R]["parameters"]): AsyncIterableIterator<OctokitTypes.OctokitResponse<PaginatingEndpoints[R]["response"]["data"]>>; | ||
/** | ||
* Get an async iterator to paginate a request using an unknown endpoint route string and optional parameters | ||
* | ||
* @see {link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of} for await...of | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {string} route Request method + URL. Example: `'GET /orgs/:org'` | ||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
*/ | ||
<T, R extends OctokitTypes.Route = OctokitTypes.Route>(octokit: Octokit, route: R, parameters?: R extends keyof PaginatingEndpoints ? PaginatingEndpoints[R]["parameters"] : OctokitTypes.RequestParameters): AsyncIterableIterator<OctokitTypes.OctokitResponse<PaginationResults<T>>>; | ||
/** | ||
* Get an async iterator to paginate a request using a request method and optional parameters | ||
* | ||
* @see {link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of} for await...of | ||
* | ||
* @param {object} octokit Octokit instance | ||
* @param {string} request `@octokit/request` or `octokit.request` method | ||
* @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
*/ | ||
<R extends OctokitTypes.RequestInterface>(octokit: Octokit, request: R, parameters?: Parameters<R>[0]): AsyncIterableIterator<NormalizeResponse<OctokitTypes.GetResponseTypeFromEndpointMethod<R>>>; | ||
}; | ||
} |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "2.5.1"; | ||
export declare const VERSION = "2.6.0"; |
@@ -1,2 +0,2 @@ | ||
const VERSION = "2.5.1"; | ||
const VERSION = "2.6.0"; | ||
@@ -93,3 +93,5 @@ /** | ||
const composePaginateRest = Object.assign(paginate, { iterator }); | ||
const composePaginateRest = Object.assign(paginate, { | ||
iterator, | ||
}); | ||
@@ -96,0 +98,0 @@ /** |
{ | ||
"name": "@octokit/plugin-paginate-rest", | ||
"description": "Octokit plugin to paginate REST API endpoint responses", | ||
"version": "2.5.1", | ||
"version": "2.6.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
120684
1912