From 516254290380a4ae5e741927fc14a378c23b1563 Mon Sep 17 00:00:00 2001 From: Luke Hagar Date: Mon, 10 Apr 2023 09:34:19 -0500 Subject: [PATCH] removed paginator --- index.ts | 2 -- paginator.ts | 63 ---------------------------------------------------- 2 files changed, 65 deletions(-) delete mode 100644 paginator.ts diff --git a/index.ts b/index.ts index b1008a8f..60dd3cea 100644 --- a/index.ts +++ b/index.ts @@ -2,6 +2,4 @@ export * from "./sdk-output/api"; export {Configuration, ConfigurationParameters} from "./sdk-output/configuration"; -export * from "./paginator"; - export * as axiosRetry from "axios-retry" \ No newline at end of file diff --git a/paginator.ts b/paginator.ts deleted file mode 100644 index e7bb9237..00000000 --- a/paginator.ts +++ /dev/null @@ -1,63 +0,0 @@ -export interface PaginationParams { - /** - * Max number of results to return. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. - * @type {number} - * @memberof AccountsApiListAccounts - */ - limit?: number; - /** - * Offset into the full result set. Usually specified with *limit* to paginate through the results. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. - * @type {number} - * @memberof AccountsApiListAccounts - */ - offset?: number; - /** - * If *true* it will populate the *X-Total-Count* response header with the number of results that would be returned if *limit* and *offset* were ignored. Since requesting a total count can have a performance impact, it is recommended not to send **count=true** if that value will not be used. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information. - * @type {boolean} - * @memberof AccountsApiListAccounts - */ - count?: boolean; - /** - * Filter results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#filtering-results) Filtering is supported for the following fields and operators: **id**: *eq, in* **identityId**: *eq* **name**: *eq, in* **nativeIdentity**: *eq, in* **sourceId**: *eq, in* **uncorrelated**: *eq* - * @type {string} - * @memberof AccountsApiListAccounts - */ - filters?: string; -} - -export interface AxiosResponse { - data: T; - status: number; - statusText: string; - request?: any; - headers: AxiosResponseHeaders; - } - export type AxiosResponseHeaders = Record & { - "set-cookie"?: string[] - }; - -export class Paginator { - public static async paginate(thisArg: T, callbackFn: (this: T, args: A) => Promise>, args?: A, increment?: number): Promise> { - let params: PaginationParams = args ? args : {limit: 0, offset: 0} - const maxLimit = params && params.limit ? params.limit : 0 - if (!params.offset) { - params.offset = 0 - } - if (!increment) { - increment = 250 - } - params.limit = increment - - let modified: TResult[] = [] - while (true) { - console.log(`Paginating call, offset = ${params.offset}`) - let results = await callbackFn.call(thisArg, params) - modified.push.apply(modified, results.data) - if (results.data.length < increment || (params.offset >= maxLimit && maxLimit > 0)) { - results.data = modified - return results - } - params.offset += increment - } - } -} \ No newline at end of file